]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In the CLI, allow comment lines that begin with '#', but only in a context
authordrh <drh@noemail.net>
Sat, 12 May 2018 23:56:22 +0000 (23:56 +0000)
committerdrh <drh@noemail.net>
Sat, 12 May 2018 23:56:22 +0000 (23:56 +0000)
where a dot-command is allowed.  In other words, '#' at the beginning of a
line in the middle of an SQL statement is just part of the SQL.

FossilOrigin-Name: 4ee136d6d2e029dad8371faf659d3a0bc0ac6ae76940db81d333848545bc990f

manifest
manifest.uuid
src/shell.c.in

index 8cf581c2464914553e59c1e25c3507cc210264a1..bd01e305f61f0a84224689e57589b2d63e070536 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sCLI,\sreturn\snon-zero\sif\sthere\sare\serrors\son\sthe\scommand-line.
-D 2018-05-11T19:11:18.935
+C In\sthe\sCLI,\sallow\scomment\slines\sthat\sbegin\swith\s'#',\sbut\sonly\sin\sa\scontext\nwhere\sa\sdot-command\sis\sallowed.\s\sIn\sother\swords,\s'#'\sat\sthe\sbeginning\sof\sa\nline\sin\sthe\smiddle\sof\san\sSQL\sstatement\sis\sjust\spart\sof\sthe\sSQL.
+D 2018-05-12T23:56:22.493
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da
@@ -494,7 +494,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
 F src/resolve.c 6415381a0e9d22c0e7cba33ca4a53f81474190862f5d4838190f5eb5b0b47bc9
 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
 F src/select.c a35d462ee7a3c0856ad7a9d9c8921fbf3d91d911a8f39ad9d61302eb43b24a71
-F src/shell.c.in 4caa8c44f4ebd2c80f42de4b0cf7ffc69b7443521ab3a42adb114932d92111a0
+F src/shell.c.in df40a09c4098d050bf5a008caa9ca8f25eed8ff9a8468d39b1f4d8a778cd324a
 F src/sqlite.h.in ef7e6fae65cb40ba004abf090ea491751295c11e64b1446322813d3b473b9400
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7
@@ -1728,7 +1728,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P dba87a201806f93a1736c1ee81d9c9cf9848e401a237dc2af3b4376402976c32
-R dde88735a12ce10911e75a8ac9c70225
+P 13e7300a37e379eac564594d78d3f039fd25737493b3b627ef02fab57a6c98e1
+R 6b32792e712eff37702825b507b2e9b6
 U drh
-Z e35f6e55abb2846b2727a31cf8bf8fdc
+Z d7c29ce2018cfc34028d7ed7f7fd8bc3
index 527272447c83c170af7568cf5088580b9e53b737..fa85b0e1dd7fe563f9ced37bd002588dd1a6af5c 100644 (file)
@@ -1 +1 @@
-13e7300a37e379eac564594d78d3f039fd25737493b3b627ef02fab57a6c98e1
\ No newline at end of file
+4ee136d6d2e029dad8371faf659d3a0bc0ac6ae76940db81d333848545bc990f
\ No newline at end of file
index 78fe0e1713128f36371fee42c03eed09854902c6..c7f41032a52d2bf024cfd57d9c8a56b6a9d042a4 100644 (file)
@@ -3679,7 +3679,7 @@ static void linenoise_completion(const char *zLine, linenoiseCompletions *lc){
   char zBuf[1000];
 
   if( nLine>sizeof(zBuf)-30 ) return;
-  if( zLine[0]=='.' ) return;
+  if( zLine[0]=='.' || zLine[0]=='#') return;
   for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
   if( i==nLine-1 ) return;
   iStart = i+1;
@@ -7969,13 +7969,15 @@ static int process_input(ShellState *p, FILE *in){
       if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine);
       continue;
     }
-    if( zLine && zLine[0]=='.' && nSql==0 ){
+    if( zLine && (zLine[0]=='.' || zLine[0]=='#') && nSql==0 ){
       if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine);
-      rc = do_meta_command(zLine, p);
-      if( rc==2 ){ /* exit requested */
-        break;
-      }else if( rc ){
-        errCnt++;
+      if( zLine[0]=='.' ){
+        rc = do_meta_command(zLine, p);
+        if( rc==2 ){ /* exit requested */
+          break;
+        }else if( rc ){
+          errCnt++;
+        }
       }
       continue;
     }