From 9fb34dbc4b06356402c0e1d15496ad7564237186 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 4 Jul 2017 07:44:30 -0400
Subject: output_hub sqlite introduce structure

---
 org/output_hub.org   | 23 +++++++++++++++++++++++
 org/sdp.org          | 16 ++++++++++++++--
 src/sdp/output/hub.d | 22 ++++++++++++++++++++++
 src/sdp/sdp.d        |  8 +++++++-
 4 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/org/output_hub.org b/org/output_hub.org
index a859d59..f4eb1de 100644
--- a/org/output_hub.org
+++ b/org/output_hub.org
@@ -32,6 +32,14 @@ template outputHub() {
     <<output_options>>
   }
 }
+template outputHubOp() {
+  <<output_imports>>
+  void outputHubOp(C)(C config) {
+    mixin SiSUoutputRgxInit;
+    auto rgx = Rgx();
+    <<output_options_op>>
+  }
+}
 #+END_SRC
 
 ** initialize / imports
@@ -158,6 +166,21 @@ if (doc_matters.opt_action["odt"]) {
 #+BEGIN_SRC d
 if (doc_matters.opt_action["sqlite"]) {
   if ((doc_matters.opt_action["verbose"])) { writeln("sqlite processing... "); }
+  // SQLtableLoad!()(doc_abstraction, doc_matters);
+}
+#+END_SRC
+
+*** sqlite (create, drop)
+
+#+name: output_options_op
+#+BEGIN_SRC d
+if ((config["sqlite-create"])) {
+  if ((config["verbose"])) { writeln("sqlite create table... "); }
+  // SQLtableCreate!()();
+}
+if ((config["sqlite-drop"])) {
+  if ((config["verbose"])) { writeln("sqlite drop table... "); }
+  // SQLtableDrop!()();
 }
 #+END_SRC
 
diff --git a/org/sdp.org b/org/sdp.org
index 2f58357..f813c5d 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -230,6 +230,8 @@ bool[string] opts = [
   "sisupod"            : false,
   "source"             : false,
   "sqlite"             : false,
+  "sqlite-create"      : false,
+  "sqlite-drop"        : false,
   "text"               : false,
   "verbose"            : false,
   "xhtml"              : false,
@@ -266,6 +268,8 @@ auto helpInfo = getopt(args,
   "qrcode",             "--qrcode with document metadata",                            &opts["qrcode"],
   "sisupod",            "--sisupod sisupod source content bundled",                   &opts["sisupod"],
   "source",             "--source markup source text content",                        &opts["source"],
+  "sqlite-create",      "--sqlite-create create db, create tables",                   &opts["sqlite-create"],
+  "sqlite-drop",        "--sqlite-drop drop tables & db",                             &opts["sqlite-drop"],
   "sqlite",             "--sqlite process sqlite output",                             &opts["sqlite"],
   "text",               "--text process text output",                                 &opts["text"],
   "txt",                "--txt process text output",                                  &opts["text"],
@@ -318,7 +322,15 @@ auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configurat
 auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make);
 #+END_SRC
 
-** _2a. processing: loop each file_ [+2]                          :loop:files:
+** 2a. actions independed of processing files
+#+NAME: sdp_do_selected
+#+BEGIN_SRC d
+if (!(opts["skip-output"])) {
+  outputHubOp!()(opts);
+}
+#+END_SRC
+
+** _2b. processing: loop each file_ [+2]                          :loop:files:
 *** scope (loop)                                                    :scope:
 
 #+NAME: sdp_each_file_do_scope
@@ -412,7 +424,7 @@ scope(exit) {
 }
 #+END_SRC
 
-** 2b. no filename provided
+** +2c. no valid filename provided+
 #+NAME: sdp_no_filename_provided
 #+BEGIN_SRC d
 /+ no recognized filename provided +/
diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d
index 2a1221f..b2ae4a6 100644
--- a/src/sdp/output/hub.d
+++ b/src/sdp/output/hub.d
@@ -74,6 +74,7 @@ template outputHub() {
     }
     if (doc_matters.opt_action["sqlite"]) {
       if ((doc_matters.opt_action["verbose"])) { writeln("sqlite processing... "); }
+      // SQLtableLoad!()(doc_abstraction, doc_matters);
     }
     if (doc_matters.opt_action["postgresql"]) {
       /+ mixin outputPostgreSQL; +/
@@ -81,3 +82,24 @@ template outputHub() {
     }
   }
 }
+template outputHubOp() {
+  import sdp.output,
+    sdp.output.epub3,
+    sdp.output.html,
+    sdp.output.xmls,
+    sdp.output.source_sisupod,
+    sdp.output.create_zip_file,
+    sdp.output.paths_output;
+  void outputHubOp(C)(C config) {
+    mixin SiSUoutputRgxInit;
+    auto rgx = Rgx();
+    if ((config["sqlite-create"])) {
+      if ((config["verbose"])) { writeln("sqlite create table... "); }
+      // SQLtableCreate!()();
+    }
+    if ((config["sqlite-drop"])) {
+      if ((config["verbose"])) { writeln("sqlite drop table... "); }
+      // SQLtableDrop!()();
+    }
+  }
+}
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d
index 60d56f9..891c23f 100755
--- a/src/sdp/sdp.d
+++ b/src/sdp/sdp.d
@@ -78,6 +78,8 @@ void main(string[] args) {
     "sisupod"            : false,
     "source"             : false,
     "sqlite"             : false,
+    "sqlite-create"      : false,
+    "sqlite-drop"        : false,
     "text"               : false,
     "verbose"            : false,
     "xhtml"              : false,
@@ -114,6 +116,8 @@ void main(string[] args) {
     "qrcode",             "--qrcode with document metadata",                            &opts["qrcode"],
     "sisupod",            "--sisupod sisupod source content bundled",                   &opts["sisupod"],
     "source",             "--source markup source text content",                        &opts["source"],
+    "sqlite-create",      "--sqlite-create create db, create tables",                   &opts["sqlite-create"],
+    "sqlite-drop",        "--sqlite-drop drop tables & db",                             &opts["sqlite-drop"],
     "sqlite",             "--sqlite process sqlite output",                             &opts["sqlite"],
     "text",               "--text process text output",                                 &opts["text"],
     "txt",                "--txt process text output",                                  &opts["text"],
@@ -152,7 +156,9 @@ void main(string[] args) {
   auto confsdl = HeaderExtractSDL();
   auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configuration);
   auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make);
-  
+  if (!(opts["skip-output"])) {
+    outputHubOp!()(opts);
+  }
   if (fns_src.length > 0) {
     foreach(fn_src; fns_src) {
       if (!empty(fn_src)) {
-- 
cgit v1.2.3