From 2bbbda58a5e2c56be6ad88ad3a296ec1b2a833fb Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 16 Nov 2022 13:02:42 -0500 Subject: configs housekeeping, minor --- org/out_sqlite.org | 64 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'org/out_sqlite.org') diff --git a/org/out_sqlite.org b/org/out_sqlite.org index a6c501d..3a201e7 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -346,35 +346,43 @@ template SQLiteTablesCreate() { return _sql_instruct; } } - if (opt_action.sqlite_db_create) { - string _db_statement; - string db_filename = (opt_action.sqliteDB_filename.length > 0) - ? opt_action.sqliteDB_filename - : (config.conf.w_srv_db_sqlite_filename.length > 0) - ? config.conf.w_srv_db_sqlite_filename - : ""; - string db_path = (opt_action.sqliteDB_path.length > 0) - ? opt_action.sqliteDB_path - : (config.conf.w_srv_db_sqlite_path.length > 0) - ? config.conf.w_srv_db_sqlite_path - : ""; - if (db_filename.length > 0 && db_path.length > 0) { - if ((opt_action.vox_gt1)) { - writeln("db name & path: ", db_path, db_filename); - } - auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path); - pth_sqlite.base.mkdirRecurse; - auto db = Database(pth_sqlite.sqlite_file); - { - _db_statement ~= SQLiteTablesReCreate!()(); - } - SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE"); - } else { - writeln("must provide db name & output root path either on the command line or in configuration file"); - writeln("db name: ", db_filename); - writeln("db path: ", db_path); - } + <> + } +} +#+END_SRC + +**** db create + +#+NAME: sqlite_db_create +#+HEADER: :noweb yes +#+BEGIN_SRC d +if (opt_action.sqlite_db_create) { + string _db_statement; + string db_filename = (opt_action.sqliteDB_filename.length > 0) + ? opt_action.sqliteDB_filename + : (config.conf.w_srv_db_sqlite_filename.length > 0) + ? config.conf.w_srv_db_sqlite_filename + : ""; + string db_path = (opt_action.sqliteDB_path.length > 0) + ? opt_action.sqliteDB_path + : (config.conf.w_srv_db_sqlite_path.length > 0) + ? config.conf.w_srv_db_sqlite_path + : ""; + if (db_filename.length > 0 && db_path.length > 0) { + if ((opt_action.vox_gt1)) { + writeln("db name & path: ", db_path, db_filename); + } + auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path); + pth_sqlite.base.mkdirRecurse; + auto db = Database(pth_sqlite.sqlite_file); + { + _db_statement ~= SQLiteTablesReCreate!()(); } + SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE"); + } else { + writeln("must provide db name & output root path either on the command line or in configuration file"); + writeln("db name: ", db_filename); + writeln("db path: ", db_path); } } #+END_SRC -- cgit v1.2.3