]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
CLI prescanner made to match SQLite's rules for delimited identifiers. Tests begun.
authorlarrybr <larrybr@noemail.net>
Sat, 11 Sep 2021 02:42:04 +0000 (02:42 +0000)
committerlarrybr <larrybr@noemail.net>
Sat, 11 Sep 2021 02:42:04 +0000 (02:42 +0000)
FossilOrigin-Name: 15b105c520968855ad960d8929f80af9e9bedc155237af9af1956f7b546947f2

manifest
manifest.uuid
src/shell.c.in
test/shell3.test
tool/replace.tcl

index d55b45613686b605f343bba14f7da385684b1f52..fcc91d81974a0ba608a7569422669285f0b7ae6d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sCLI\sprescan\shandle\sgoofy\sidentifier\sdelimiters\stoo.\sStreamline\scode.
-D 2021-09-10T19:45:22.999
+C CLI\sprescanner\smade\sto\smatch\sSQLite's\srules\sfor\sdelimited\sidentifiers.\sTests\sbegun.
+D 2021-09-11T02:42:04.707
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -545,7 +545,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
 F src/resolve.c 42b94d37a54200707a95566eff4f7e8a380e32d080016b699f23bd79a73a5028
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c b2c48dfc02b486fd2da2be1605503615958ba1997d40d994c2946975d0150a31
-F src/shell.c.in f857f13def27b87c6759a537b4d53b30c5c232736b8b31040ba3eb49714a0de3
+F src/shell.c.in be7cd92c042b5e16bfd727404c5b2ec72c8e177ee2e092da6fe3ea031bbf8ece
 F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
@@ -1373,7 +1373,7 @@ F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8
 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
 F test/shell1.test 56a7358a2a05e850e9e4aa24629db9c8975e8038dbe8debd2d95be22a5f03612
 F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
-F test/shell3.test ac8c2b744014c3e9a0e26bfd829ab65f00923dc1a91ffd044863e9423cc91494
+F test/shell3.test 1586a163e7918775d3c25530bf84200453f30a77cc338490389114a67352f4d9
 F test/shell4.test 3ed6c4b42fd695efcbc25d69ef759dbb15855ca8e52ba6c5ee076f8b435f48be
 F test/shell5.test 84a30b55722a95a5b72989e691c469a999ca7591e7aa00b7fabc783ea5c9a6fe
 F test/shell6.test 1ceb51b2678c472ba6cf1e5da96679ce8347889fe2c3bf93a0e0fa73f00b00d3
@@ -1868,7 +1868,7 @@ F tool/offsets.c 8ed2b344d33f06e71366a9b93ccedaa38c096cc1dbd4c3c26ad08c611528584
 F tool/omittest.tcl 3d222272b1d840b4e3d67bff0cb743ce3f633faddadb3702b2056b726775db8f
 F tool/opcodesum.tcl 740ed206ba8c5040018988129abbf3089a0ccf4a
 F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b
-F tool/replace.tcl 60f91e8dd06ab81f74d213ecbd9c9945f32ac048
+F tool/replace.tcl 937c931ad560688e85bdd6258bdc754371bb1e2732e1fb28ef441e44c9228fce
 F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5
 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076
@@ -1922,7 +1922,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c4568f9f458bad16bd4481f1f6f5e7b6f39f5ccf23f2b05890078577ce2ab9a2
-R eb5e78e09aa48719a67382400efc7d61
+P 968aed690ba7240f8a256f5ba679cc971f432ff9af0ff99744824af79b952545
+Q +2dd61dd97b0326b59b0bc3c83b4d4b9acf811c5acae4d1003e7525ba7a26daf5
+R 646f691d304e0a026b7432ed79848447
 U larrybr
-Z d182a98bc0a685d688796d8bc75a9046
+Z d0aaf8bc6b08262fe824a57812c4fb12
index b2cde8ca439bd47d69fdb4246c15406e87dc2ef2..75e634258e5b658389839aa451945d35f46a7fda 100644 (file)
@@ -1 +1 @@
-968aed690ba7240f8a256f5ba679cc971f432ff9af0ff99744824af79b952545
\ No newline at end of file
+15b105c520968855ad960d8929f80af9e9bedc155237af9af1956f7b546947f2
\ No newline at end of file
index 9ea31a0926eddbe85123b3a818c675b400488fb2..712169cde6fd388419d03b82b36d26e845134e3b 100644 (file)
@@ -10625,7 +10625,6 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
   case QSS_InPlain:
   InPlainSet:
     qss = QSS_SETV(qss, QSS_InPlain);
-  InPlain:
     while (cin = *zLine++){
       if( IsSpace(cin) )
         continue;
@@ -10667,7 +10666,10 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
       char cLeave = qss >> QSS_CharShift;
       while (cin = *zLine++){
         if( cin==cLeave ){
-          goto InPlainSet;
+          if(*zLine==cLeave && cLeave!=']')
+            ++zLine;
+          else
+            goto InPlainSet;
         }
       }
     }
index 63c30a2682ae0adf47bb77ec189a5f363ae63def..714a4781ea7d3eda8b51e66fc1620ae80f1549b0 100644 (file)
@@ -18,6 +18,7 @@
 #
 #   shell3-1.*: Basic tests for running SQL statments from command line.
 #   shell3-2.*: Basic tests for running SQL file from command line.
+#   shell3-3.*: Basic tests for processing odd SQL constructs.
 #
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -26,6 +27,7 @@ db close
 forcedelete test.db test.db-journal test.db-wal
 sqlite3 db test.db
 
+
 # There are inconsistencies in command-line argument quoting on Windows.
 # In particular, individual applications are responsible for command-line
 # parsing in Windows, not the shell.  Depending on whether the sqlite3.exe
@@ -98,4 +100,39 @@ do_test shell3-2.7 {
   catchcmd "foo.db" "CREATE TABLE"
 } {1 {Error: near line 1: incomplete input}}
 
+
+#----------------------------------------------------------------------------
+#   shell3-3.*: Basic tests for processing odd SQL constructs.
+#
+
+# Run combinations of odd identifiers, comments, semicolon placement
+do_test shell3-3.1 {
+  forcedelete foo.db
+  set rc [ catchcmd "foo.db" {CREATE TABLE t1("
+a--.
+" --x
+); CREATE TABLE t2("a[""b""]");
+.header on
+INSERT INTO t1 VALUES ('
+x''y');
+INSERT INTO t2 VALUES ('
+/*.
+.*/ x
+''y');
+SELECT * from t1 limit 1;
+SELECT * from t2 limit 1;
+} ]
+  set fexist [file exist foo.db]
+  list $rc $fexist
+} {{0 {
+a--.
+
+
+x'y
+a["b"]
+
+/*.
+.*/ x
+'y}} 1}
+
 finish_test
index 5a1ac5983c44c9233aa7e954121d7e38f6f30f29..e87cb922f2a7a494fb211e6a92d107459e11b3bf 100644 (file)
@@ -9,7 +9,7 @@ fconfigure stderr -translation binary -encoding binary
 set mode [string tolower [lindex $argv 0]]
 set from [lindex $argv 1]
 set to [lindex $argv 2]
-if {$mode ni [list exact regsub include]} {exit 1}
+if {-1 == [lsearch -exact [list exact regsub include] $mode]} {exit 1}
 if {[string length $from]==0} {exit 2}
 while {![eof stdin]} {
   set line [gets stdin]