From 3d45c4b87a3e95b3aea0a3b9f4772967f18ceaeb Mon Sep 17 00:00:00 2001 From: Will Budic Date: Tue, 4 Feb 2020 11:45:24 +1100 Subject: [PATCH] prep for 1.7 release. --- CNF_Specs.md | 45 ++++++++++++++++++---- htdocs/cgi-bin/system/modules/CNFParser.pm | 17 ++++---- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/CNF_Specs.md b/CNF_Specs.md index f90eaec..1df1d77 100644 --- a/CNF_Specs.md +++ b/CNF_Specs.md @@ -36,16 +36,23 @@ And are recognised as constants, anons and sqlites. * There is no database interaction, handling or processing as part of this processing. ## CNF Tag Formats + ### Property Value Tag + <<{name}<{value}>> + ### Instruction Value Tag + <<<{instruction} {value\n...valuen\n}>> + ### Full Tag + <<{name}>{instruction} {value\n...value\n} >> -**Examples** + +**Examples:** <$HELP Sorry help is currently. @@ -61,20 +68,42 @@ And are recognised as constants, anons and sqlites. ## SQL Instruction Formatting -(section not complete, as of 2020-02-02) +(section not complete, as of 2020-02-04) * SQLites have the following reserved instructions. * TABLE - * INDEX - * DATA <TABLE - ID INT PRIMARY KEY NOT NULL, - ALIAS VCHAR(16), - EMAIL VCHAR(28), - FULL_NAME VCHAR(128) + ID INT PRIMARY KEY NOT NULL, + ALIAS VCHAR(16) UNIQUE CONSTRAINT, + EMAIL VCHAR(28), + FULL_NAME VCHAR(128) >> + * INDEX + + <> + + * SQL + * SQL statments are actual full SQL statments placed in the tag body. + + <VIEW + CREATE VIEW VW_ALIASES AS SELECT ID,ALIAS ORDER BY ALIAS; + >> + + * DATA + * Data columns are delimited with the **`** delimiter. In the tag body. + * These should apear as last in the config file as they are translated into insert statements. + + <> + + *** diff --git a/htdocs/cgi-bin/system/modules/CNFParser.pm b/htdocs/cgi-bin/system/modules/CNFParser.pm index 4f8a1ed..707c4a9 100755 --- a/htdocs/cgi-bin/system/modules/CNFParser.pm +++ b/htdocs/cgi-bin/system/modules/CNFParser.pm @@ -92,13 +92,7 @@ try{ } # print "Ins($i): with $e do $t\n"; - if($t eq 'TABLE'){ - $st = "CREATE TABLE $e(\n$v\n);"; - } - elsif($t eq 'INDEX'){ - $st = "CREATE INDEX $v;"; - } - elsif($t eq 'DATA'){ + if($t eq 'DATA'){ $st =""; foreach(split /\n/,$v){ my $d = $i = ""; @@ -129,6 +123,15 @@ try{ $st .="INSERT INTO $e VALUES($i);\n" if $i; } } + elsif($t eq 'TABLE'){ + $st = "CREATE TABLE $e(\n$v\n);"; + } + elsif($t eq 'INDEX'){ + $st = "CREATE INDEX $v;"; + } + elsif($t eq 'VIEW'){ + $st = "CREATE VIEW $v;"; + } else{ #Register application statement as an anonymouse one. $anons{$e} = $v; -- 2.34.1