From 629af1457bf724ba9f0213a9b0e2ca1757f92705 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 11 Apr 2018 21:12:24 -0400 Subject: various minor --- src/sdp/output/sqlite_discrete.d | 73 +++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 31 deletions(-) (limited to 'src/sdp/output/sqlite_discrete.d') 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