]> lifelog.hopto.org Git - LifeLog.git/commitdiff
prep for 1.7 release.
authorWill Budic <redacted>
Tue, 4 Feb 2020 00:45:24 +0000 (11:45 +1100)
committerWill Budic <redacted>
Tue, 4 Feb 2020 00:45:24 +0000 (11:45 +1100)
CNF_Specs.md
htdocs/cgi-bin/system/modules/CNFParser.pm

index f90eaec9922d44a3536aa9ee555465e3008c3e8e..1df1d77fc8af88e1dbd88a0272746e760773c09a 100644 (file)
@@ -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:**
 
     <<CONST>$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
 
         <<MyAliasTable>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
+
+        <<MyAliasTable<INDEX
+            idx_alias on MyAliasTable (ALIAS);
+        >>
+
+  * SQL
+    * SQL statments are actual full SQL statments placed in the tag body.
+
+            <<VW_ALIASES>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.
+
+            <<MyAliasTable<DATA
+                01`admin`admin@inc.com`Super User
+                02`chef`chef@inc.com`Bruno Allinoise
+                03`juicy`sfox@inc.com`Samantha Fox
+            >>
+
+
 ***
 
 
index 4f8a1ed379308d2514b5862ded0eeea123f8150c..707c4a9fcc442543ed9a779a91c0800a8024ef60 100755 (executable)
@@ -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;