diff options
Diffstat (limited to 'org/out_sqlite.org')
-rw-r--r-- | org/out_sqlite.org | 64 |
1 files changed, 36 insertions, 28 deletions
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); - } + <<sqlite_db_create>> + } +} +#+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 |