From 629af1457bf724ba9f0213a9b0e2ca1757f92705 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 11 Apr 2018 21:12:24 -0400 Subject: various minor --- .gitignore | 3 ++ dub.sdl | 2 +- dub.selections.json | 2 +- makefile | 7 +++- maker.org | 19 +++++++++- org/meta_read_source_files.org | 12 +++--- org/output_sqlite.org | 10 ++--- org/output_sqlite_discrete.org | 79 +++++++++++++++++++++++----------------- src/sdp/meta/read_config_files.d | 8 ++-- src/sdp/meta/read_source_files.d | 4 +- src/sdp/output/sqlite_discrete.d | 73 +++++++++++++++++++++---------------- 11 files changed, 132 insertions(+), 87 deletions(-) diff --git a/.gitignore b/.gitignore index a929535..d74bba5 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ .dub/** .reggae/** tmp/** +*_.org +*_.d +*_.txt *_ *~ \#* diff --git a/dub.sdl b/dub.sdl index 1b773ae..2e1c502 100644 --- a/dub.sdl +++ b/dub.sdl @@ -10,7 +10,7 @@ stringImportPaths "./views" buildRequirements "allowWarnings" dependency "toml" version="~>0.4.0-rc.2" # https://code.dlang.org/packages/toml https://github.com/toml-lang/toml/wiki dependency "toml:json" version="~>0.4.0-rc.2" -dependency "d2sqlite3" version="~>0.13.1" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html +dependency "d2sqlite3" version="~>0.16.0" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html subconfiguration "d2sqlite3" "all-included" dependency "archive" version="~>0.6.0" # http://code.dlang.org/packages/archive https://github.com/rcythr/archive configuration "reggae" { diff --git a/dub.selections.json b/dub.selections.json index 4ae7074..dda658d 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -2,7 +2,7 @@ "fileVersion": 1, "versions": { "archive": "0.6.0", - "d2sqlite3": "0.13.1", + "d2sqlite3": "0.16.0", "libinputvisitor": "1.2.2", "sdlang-d": "0.10.2", "taggedalgebraic": "0.10.9", diff --git a/makefile b/makefile index b090f63..ec5c469 100644 --- a/makefile +++ b/makefile @@ -15,8 +15,11 @@ EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONT ORGFILELIST=$(shell echo `ls -1 maker.org org/*.org`) ORGFILES="" ORGDIR :=$(shell echo `pwd`) +SiSU_MARKUP_SAMPLES_FIND_PODS= \ +find data/sisupod -maxdepth 2 -name sisupod.manifest | cut -f 1-3 -d / | sort + SiSU_MARKUP_SAMPLES_PODS_FOUND= \ -find data/sisupod -maxdepth 2 -name sisupod.manifest | cut -f 1-3 -d / | sort | xargs +$(SiSU_MARKUP_SAMPLES_FIND_PODS) | xargs SiSU_MARKUP_SAMPLES_POD = \ data/sisupod/accelerando.charles_stross \ @@ -175,6 +178,8 @@ ragga: reggae -b binary reggae -b ninja build +find_pods: + $(SiSU_MARKUP_SAMPLES_FIND_PODS) dmd_testrun_find: ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ diff --git a/maker.org b/maker.org index fc2b740..c7a0e74 100644 --- a/maker.org +++ b/maker.org @@ -57,8 +57,11 @@ ORGDIR :=$(shell echo `pwd`) **** pods #+BEGIN_SRC makefile :tangle makefile +SiSU_MARKUP_SAMPLES_FIND_PODS= \ +find data/sisupod -maxdepth 2 -name sisupod.manifest | cut -f 1-3 -d / | sort + SiSU_MARKUP_SAMPLES_PODS_FOUND= \ -find data/sisupod -maxdepth 2 -name sisupod.manifest | cut -f 1-3 -d / | sort | xargs +$(SiSU_MARKUP_SAMPLES_FIND_PODS) | xargs SiSU_MARKUP_SAMPLES_POD = \ data/sisupod/accelerando.charles_stross \ @@ -382,6 +385,13 @@ ragga: *** testrun (program against document markup) **** pods +****** find files + +#+BEGIN_SRC makefile :tangle makefile +find_pods: + $(SiSU_MARKUP_SAMPLES_FIND_PODS) +#+END_SRC + ***** dmd ****** find files @@ -805,7 +815,7 @@ stringImportPaths "./views" buildRequirements "allowWarnings" dependency "toml" version="~>0.4.0-rc.2" # https://code.dlang.org/packages/toml https://github.com/toml-lang/toml/wiki dependency "toml:json" version="~>0.4.0-rc.2" -dependency "d2sqlite3" version="~>0.13.1" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html +dependency "d2sqlite3" version="~>0.16.0" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html subconfiguration "d2sqlite3" "all-included" dependency "archive" version="~>0.6.0" # http://code.dlang.org/packages/archive https://github.com/rcythr/archive #+END_SRC @@ -1094,6 +1104,9 @@ mixin build!(_compile, _dub_conf); .dub/** .reggae/** tmp/** +*_.org +*_.d +*_.txt *_ *~ \#* @@ -1175,6 +1188,8 @@ time make ragga time make restart time make restart ldc time make tangle ldc + +time make ldc_testrun_find_pod_epub #+END_SRC *** reggae diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org index 0879ab5..ab73040 100644 --- a/org/meta_read_source_files.org +++ b/org/meta_read_source_files.org @@ -55,7 +55,7 @@ static template readConfigSite() { auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site; foreach(conf_fn; [_conf_file_details.config_filename_site_toml]) { foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; @@ -107,7 +107,7 @@ static template readConfigDoc() { auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.sisu_document_make; foreach(conf_fn; [_conf_file_details.config_filename_document_toml]) { foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; @@ -163,7 +163,7 @@ static template configReadInSiteTOML() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; if (config_file_str.length > 0) { break; } @@ -202,7 +202,7 @@ static template configReadInDocTOML() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; if (config_file_str.length > 0) { break; } @@ -665,7 +665,7 @@ if (type["curly_code"] == 1) { auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; - insert_file_list ~= to!string(fn_src_insert); + insert_file_list ~= fn_src_insert.to!string; auto raw = MarkupRawUnit(); /+ TODO +/ auto markup_sourcefile_insert_content @@ -682,7 +682,7 @@ if (type["curly_code"] == 1) { auto contents_insert_tu = ins.scan_subdoc_source( _opt_action, markup_sourcefile_insert_content, - to!string(fn_src_insert) + fn_src_insert.to!string ); contents ~= contents_insert_tu[0]; // images to extract for image list? if (_opt_action.source || _opt_action.sisupod) { diff --git a/org/output_sqlite.org b/org/output_sqlite.org index 710e9df..82b4310 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -36,7 +36,7 @@ template SQLiteBuildTablesAndPopulate() { mixin SiSUoutputRgxInit; struct sqlite_format_and_load_objects { <> - <> + <> <> <> <> @@ -152,7 +152,7 @@ light html objects ***** munge ****** general munge (special characters, inline markup, move notes) -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d auto munge_html(O)( auto return ref const O obj, @@ -207,7 +207,7 @@ auto munge_html(O)( ****** special characters -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_special_characters(string _txt){ _txt = (_txt) @@ -223,7 +223,7 @@ string html_special_characters(string _txt){ ****** special characters for code -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_special_characters_code(string _txt){ _txt = (_txt) @@ -238,7 +238,7 @@ string html_special_characters_code(string _txt){ ****** font_face -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_font_face(string _txt){ _txt = (_txt) diff --git a/org/output_sqlite_discrete.org b/org/output_sqlite_discrete.org index ecf8033..c659441 100644 --- a/org/output_sqlite_discrete.org +++ b/org/output_sqlite_discrete.org @@ -36,7 +36,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { mixin SiSUoutputRgxInit; struct sqlite_format_and_load_objects { <> - <> + <> <> <> <> @@ -49,7 +49,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { auto ref I doc_matters, ) { <> - <> + <> <> /* */<> <> @@ -152,13 +152,13 @@ light html objects ***** munge ****** general munge (special characters, inline markup, move notes) -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d auto munge_html(O)( auto return ref const O obj, ) { string _html_special_characters(string _txt){ - _txt = (_txt) + _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) .replaceAll(rgx.xhtml_less_than, "<") @@ -168,17 +168,17 @@ auto munge_html(O)( return _txt; } string _html_font_face(string _txt){ - _txt = (_txt) - .replaceAll(rgx.inline_emphasis, ("$1")) - .replaceAll(rgx.inline_bold, ("$1")) - .replaceAll(rgx.inline_underscore, ("$1")) - .replaceAll(rgx.inline_italics, ("$1")) - .replaceAll(rgx.inline_superscript, ("$1")) - .replaceAll(rgx.inline_subscript, ("$1")) - .replaceAll(rgx.inline_strike, ("$1")) - .replaceAll(rgx.inline_insert, ("$1")) - .replaceAll(rgx.inline_mono, ("$1")) - .replaceAll(rgx.inline_cite, ("$1")); + _txt = _txt + .replaceAll(rgx.inline_emphasis, "$1") + .replaceAll(rgx.inline_bold, "$1") + .replaceAll(rgx.inline_underscore, "$1") + .replaceAll(rgx.inline_italics, "$1") + .replaceAll(rgx.inline_superscript, "$1") + .replaceAll(rgx.inline_subscript, "$1") + .replaceAll(rgx.inline_strike, "$1") + .replaceAll(rgx.inline_insert, "$1") + .replaceAll(rgx.inline_mono, "$1") + .replaceAll(rgx.inline_cite, "$1"); return _txt; } string _notes; @@ -207,7 +207,7 @@ auto munge_html(O)( ****** special characters -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_special_characters(string _txt){ _txt = (_txt) @@ -223,7 +223,7 @@ string html_special_characters(string _txt){ ****** special characters for code -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_special_characters_code(string _txt){ _txt = (_txt) @@ -238,20 +238,20 @@ string html_special_characters_code(string _txt){ ****** font_face -#+name: sanitize_and_mmunge_inline_html +#+name: sanitize_and_munge_inline_html #+BEGIN_SRC d string html_font_face(string _txt){ _txt = (_txt) - .replaceAll(rgx.inline_emphasis, ("$1")) - .replaceAll(rgx.inline_bold, ("$1")) - .replaceAll(rgx.inline_underscore, ("$1")) - .replaceAll(rgx.inline_italics, ("$1")) - .replaceAll(rgx.inline_superscript, ("$1")) - .replaceAll(rgx.inline_subscript, ("$1")) - .replaceAll(rgx.inline_strike, ("$1")) - .replaceAll(rgx.inline_insert, ("$1")) - .replaceAll(rgx.inline_mono, ("$1")) - .replaceAll(rgx.inline_cite, ("$1")); + .replaceAll(rgx.inline_emphasis, "$1") + .replaceAll(rgx.inline_bold, "$1") + .replaceAll(rgx.inline_underscore, "$1") + .replaceAll(rgx.inline_italics, "$1") + .replaceAll(rgx.inline_superscript, "$1") + .replaceAll(rgx.inline_subscript, "$1") + .replaceAll(rgx.inline_strike, "$1") + .replaceAll(rgx.inline_insert, "$1") + .replaceAll(rgx.inline_mono, "$1") + .replaceAll(rgx.inline_cite, "$1"); return _txt; } #+END_SRC @@ -413,7 +413,7 @@ auto html_table(O)( auto return ref const O obj, string _txt, ) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); + string[] _table_rows = _txt.split(rgx.table_delimiter_row); string[] _table_cols; string _table; string _tablenote; @@ -429,9 +429,17 @@ auto html_table(O)( string _align = ("style=\"text-align:" ~ ((obj.table_column_aligns[col_idx] == "l") ? "left\"" : "right\"")); - _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table_column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">"; + _table ~= "<" + ~ _col_is + ~ " width=\"" + ~ obj.table_column_widths[col_idx].to!string + ~ "%\" " + ~ _align + ~ ">"; _table ~= cell; - _table ~= ""; + _table ~= ""; } } _table ~= ""; @@ -480,6 +488,7 @@ db.run(" DROP TABLE IF EXISTS metadata_and_text; DROP TABLE IF EXISTS doc_objects; DROP TABLE IF EXISTS urls; +BEGIN; #+END_SRC ******* 1. create tables @@ -607,13 +616,14 @@ CREATE TABLE doc_objects ( digest_clean CHAR(256), digest_all CHAR(256), types CHAR(1) NULL -) +); #+END_SRC ****** d } #+name: sqlite_close_initialize #+BEGIN_SRC d + COMMIT "); #+END_SRC @@ -915,7 +925,7 @@ insert_metadata.inject( #+name: sqlite_insert_doc_objects #+BEGIN_SRC d -Statement insert_doc_objects = db.prepare(" +Statement _insert_doc_objects = db.prepare(" #+END_SRC ********* sql insert into @@ -1010,7 +1020,7 @@ either: #+name: sqlite_insert_doc_objects #+BEGIN_SRC d "); -return insert_doc_objects; +return _insert_doc_objects; #+END_SRC ******* TODO (within loop not here - insert doc objects @@ -1440,6 +1450,7 @@ foreach (part; doc_parts) { insert_doc_objects.execute(); insert_doc_objects.reset(); } } +insert_doc_objects.finalize(); #+END_SRC * __END__ diff --git a/src/sdp/meta/read_config_files.d b/src/sdp/meta/read_config_files.d index 74c5a12..56a2bf8 100644 --- a/src/sdp/meta/read_config_files.d +++ b/src/sdp/meta/read_config_files.d @@ -20,7 +20,7 @@ static template configReadInSiteTOML() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; if (config_file_str.length > 0) { break; } @@ -57,7 +57,7 @@ static template configReadInDocTOML() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; if (config_file_str.length > 0) { break; } @@ -110,7 +110,7 @@ static template readConfigSite() { auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site; foreach(conf_fn; [_conf_file_details.config_filename_site_toml]) { foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; @@ -160,7 +160,7 @@ static template readConfigDoc() { auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.sisu_document_make; foreach(conf_fn; [_conf_file_details.config_filename_document_toml]) { foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array; + auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d index 5c7d83b..135d8e8 100644 --- a/src/sdp/meta/read_source_files.d +++ b/src/sdp/meta/read_source_files.d @@ -289,7 +289,7 @@ static template SiSUrawMarkupContent() { auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; - insert_file_list ~= to!string(fn_src_insert); + insert_file_list ~= fn_src_insert.to!string; auto raw = MarkupRawUnit(); /+ TODO +/ auto markup_sourcefile_insert_content @@ -306,7 +306,7 @@ static template SiSUrawMarkupContent() { auto contents_insert_tu = ins.scan_subdoc_source( _opt_action, markup_sourcefile_insert_content, - to!string(fn_src_insert) + fn_src_insert.to!string ); contents ~= contents_insert_tu[0]; // images to extract for image list? if (_opt_action.source || _opt_action.sisupod) { diff --git a/src/sdp/output/sqlite_discrete.d b/src/sdp/output/sqlite_discrete.d index b256389..541c4d8 100644 --- a/src/sdp/output/sqlite_discrete.d +++ b/src/sdp/output/sqlite_discrete.d @@ -56,7 +56,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { auto return ref const O obj, ) { string _html_special_characters(string _txt){ - _txt = (_txt) + _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) .replaceAll(rgx.xhtml_less_than, "<") @@ -66,17 +66,17 @@ template SQLiteDiscreteBuildTablesAndPopulate() { return _txt; } string _html_font_face(string _txt){ - _txt = (_txt) - .replaceAll(rgx.inline_emphasis, ("$1")) - .replaceAll(rgx.inline_bold, ("$1")) - .replaceAll(rgx.inline_underscore, ("$1")) - .replaceAll(rgx.inline_italics, ("$1")) - .replaceAll(rgx.inline_superscript, ("$1")) - .replaceAll(rgx.inline_subscript, ("$1")) - .replaceAll(rgx.inline_strike, ("$1")) - .replaceAll(rgx.inline_insert, ("$1")) - .replaceAll(rgx.inline_mono, ("$1")) - .replaceAll(rgx.inline_cite, ("$1")); + _txt = _txt + .replaceAll(rgx.inline_emphasis, "$1") + .replaceAll(rgx.inline_bold, "$1") + .replaceAll(rgx.inline_underscore, "$1") + .replaceAll(rgx.inline_italics, "$1") + .replaceAll(rgx.inline_superscript, "$1") + .replaceAll(rgx.inline_subscript, "$1") + .replaceAll(rgx.inline_strike, "$1") + .replaceAll(rgx.inline_insert, "$1") + .replaceAll(rgx.inline_mono, "$1") + .replaceAll(rgx.inline_cite, "$1"); return _txt; } string _notes; @@ -122,16 +122,16 @@ template SQLiteDiscreteBuildTablesAndPopulate() { } string html_font_face(string _txt){ _txt = (_txt) - .replaceAll(rgx.inline_emphasis, ("$1")) - .replaceAll(rgx.inline_bold, ("$1")) - .replaceAll(rgx.inline_underscore, ("$1")) - .replaceAll(rgx.inline_italics, ("$1")) - .replaceAll(rgx.inline_superscript, ("$1")) - .replaceAll(rgx.inline_subscript, ("$1")) - .replaceAll(rgx.inline_strike, ("$1")) - .replaceAll(rgx.inline_insert, ("$1")) - .replaceAll(rgx.inline_mono, ("$1")) - .replaceAll(rgx.inline_cite, ("$1")); + .replaceAll(rgx.inline_emphasis, "$1") + .replaceAll(rgx.inline_bold, "$1") + .replaceAll(rgx.inline_underscore, "$1") + .replaceAll(rgx.inline_italics, "$1") + .replaceAll(rgx.inline_superscript, "$1") + .replaceAll(rgx.inline_subscript, "$1") + .replaceAll(rgx.inline_strike, "$1") + .replaceAll(rgx.inline_insert, "$1") + .replaceAll(rgx.inline_mono, "$1") + .replaceAll(rgx.inline_cite, "$1"); return _txt; } auto html_heading(O)( @@ -223,7 +223,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { auto return ref const O obj, string _txt, ) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); + string[] _table_rows = _txt.split(rgx.table_delimiter_row); string[] _table_cols; string _table; string _tablenote; @@ -239,9 +239,17 @@ template SQLiteDiscreteBuildTablesAndPopulate() { string _align = ("style=\"text-align:" ~ ((obj.table_column_aligns[col_idx] == "l") ? "left\"" : "right\"")); - _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table_column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">"; + _table ~= "<" + ~ _col_is + ~ " width=\"" + ~ obj.table_column_widths[col_idx].to!string + ~ "%\" " + ~ _align + ~ ">"; _table ~= cell; - _table ~= ""; + _table ~= ""; } } _table ~= ""; @@ -461,9 +469,10 @@ template SQLiteDiscreteBuildTablesAndPopulate() { auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); // auto db = Database(":memory:"); // open database in memory db.run(" - DROP TABLE IF EXISTS metadata_and_text; - DROP TABLE IF EXISTS doc_objects; - DROP TABLE IF EXISTS urls; + DROP TABLE IF EXISTS metadata_and_text; + DROP TABLE IF EXISTS doc_objects; + DROP TABLE IF EXISTS urls; + BEGIN; CREATE TABLE metadata_and_text ( tid BIGINT PRIMARY KEY, title VARCHAR(800) NOT NULL, @@ -579,7 +588,8 @@ template SQLiteDiscreteBuildTablesAndPopulate() { digest_clean CHAR(256), digest_all CHAR(256), types CHAR(1) NULL - ) + ); + COMMIT "); Statement insert_metadata = db.prepare(" INSERT INTO metadata_and_text ( @@ -820,7 +830,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { } assert(db.totalChanges == 1); // - Statement insert_doc_objects = db.prepare(" + Statement _insert_doc_objects = db.prepare(" INSERT INTO doc_objects ( lid, metadata_tid, @@ -890,7 +900,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { :types ) "); - return insert_doc_objects; + return _insert_doc_objects; } } template SQLiteObjectsLoop() { @@ -1074,6 +1084,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() { insert_doc_objects.execute(); insert_doc_objects.reset(); } } + insert_doc_objects.finalize(); } } SQLiteObjectsLoop!()(doc_matters.xml.keys_seq.sql); -- cgit v1.2.3