]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Speedup CLI's gulping of many huge block SQL comments.
authorlarrybr <larrybr@noemail.net>
Wed, 8 Sep 2021 21:49:03 +0000 (21:49 +0000)
committerlarrybr <larrybr@noemail.net>
Wed, 8 Sep 2021 21:49:03 +0000 (21:49 +0000)
FossilOrigin-Name: 729620c5c0c642243be2fdda98f18d04efaf78ce365092e655cf60c9fee0874f

manifest
manifest.uuid
src/shell.c.in

index 18e937f8e5279ec1885a70b3a0d27a349a7dd6dd..5f1b58b7d1b9d7cd7ef18e2ffe4eec1f3671c21c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sPRAGMA\sintegrity_check\sso\sthat\sit\sdoes\snot\stry\sto\senforce\stypes\son\nANY\scolumns\sin\sa\sSTRICT\stable.
-D 2021-09-08T19:25:21.930
+C Speedup\sCLI's\sgulping\sof\smany\shuge\sblock\sSQL\scomments.
+D 2021-09-08T21:49:03.998
 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 34cc533f27d522c7c93fe38c99867c460b0b08be9c1c315dbd360ba5d865b19f
+F src/shell.c.in af6c3a4942c17a5e28cd47cc111d2f6d6946388c1ff0f5a402208e3f28b666bf
 F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
@@ -1922,7 +1922,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 5bdd8466129b8e477c8349847f19f2a5adea3f650cca6dbafa3b835e5a538d09
-R 0519abc6cb0d46b652034c6e6c65f10c
-U drh
-Z a82d94c048de23aeaa07149c70618cf1
+P 57384fda8db43964871be5e48ae1c72c67533046b523f161d60a41fdc8e96b9e
+R 2b022e2a0396b3f75d5529f12b4e770c
+U larrybr
+Z ed2b484e69af4b239fb95ba99431cfdf
index 84c4ea9f5e0687772c34ddd76de06771f387fea1..12da5715598dd7c9d3764b8d2a90caf785b612c2 100644 (file)
@@ -1 +1 @@
-57384fda8db43964871be5e48ae1c72c67533046b523f161d60a41fdc8e96b9e
\ No newline at end of file
+729620c5c0c642243be2fdda98f18d04efaf78ce365092e655cf60c9fee0874f
\ No newline at end of file
index 10844ddeb995ff9ea6f658f30c0c74f239ecf6ce..438119c08f6266a9034e9230fe3d49e944d61cf1 100644 (file)
@@ -10729,6 +10729,7 @@ static int process_input(ShellState *p){
   int rc;                   /* Error code */
   int errCnt = 0;           /* Number of errors seen */
   int startline = 0;        /* Line number for start of current input */
+  int bAllWhite = 1;        /* Accumulated line empty or all whitespace */
 
   p->lineno = 0;
   while( errCnt==0 || !bail_on_error || (p->in==0 && stdin_is_interactive) ){
@@ -10744,9 +10745,14 @@ static int process_input(ShellState *p){
       seenInterrupt = 0;
     }
     p->lineno++;
-    if( nSql==0 && _all_whitespace(zLine) ){
-      if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine);
-      continue;
+    if( _all_whitespace(zLine) ){
+      if( nSql==0 ){
+        if( ShellHasFlag(p, SHFLG_Echo) )
+          printf("%s\n", zLine);
+        continue;
+      }
+    }else{
+      bAllWhite = 0;
     }
     if( zLine && (zLine[0]=='.' || zLine[0]=='#') && nSql==0 ){
       if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine);
@@ -10765,7 +10771,8 @@ static int process_input(ShellState *p){
     }
     nLine = strlen30(zLine);
     if( nSql+nLine+2>=nAlloc ){
-      nAlloc = nSql+nLine+100;
+      /* Grow buffer by half-again increments when big. */
+      nAlloc = nSql+(nSql>>1)+nLine+100;
       zSql = realloc(zSql, nAlloc);
       if( zSql==0 ) shell_out_of_memory();
     }
@@ -10793,12 +10800,12 @@ static int process_input(ShellState *p){
         clearTempFile(p);
       }
       p->bSafeMode = p->bSafeModePersist;
-    }else if( nSql && _all_whitespace(zSql) ){
+    }else if( nSql && bAllWhite ){
       if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zSql);
       nSql = 0;
     }
   }
-  if( nSql && !_all_whitespace(zSql) ){
+  if( nSql && !bAllWhite ){
     errCnt += runOneSqlLine(p, zSql, p->in, startline);
   }
   free(zSql);