]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the CLI so that it can handle inputs larger than 2 billion lines.
authordrh <>
Tue, 28 Oct 2025 10:44:26 +0000 (10:44 +0000)
committerdrh <>
Tue, 28 Oct 2025 10:44:26 +0000 (10:44 +0000)
FossilOrigin-Name: 5daebf2d6013e73d89c9feb796e15b67c39577e5a9e9c86fa260995f4118f04b

manifest
manifest.uuid
src/shell.c.in

index 002174db2748de027742a9fe07f37e5254ab3080..7d1e1f5059fd204fb8291bc3df3ed431cdccd61e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sminor\sover-allocation\sof\sheap\smemory\sin\swal.c.
-D 2025-10-27T11:39:07.586
+C Enhance\sthe\sCLI\sso\sthat\sit\scan\shandle\sinputs\slarger\sthan\s2\sbillion\slines.
+D 2025-10-28T10:44:26.253
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -736,7 +736,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957
-F src/shell.c.in e58b0cecf2579c0115253e9c02a44b54fbadf77f4f33b43cfaa48a8274c9aa01
+F src/shell.c.in ce9953719b1e544e71cc47f3b9b699440e4f441418506c0913484c58a27b36b6
 F src/sqlite.h.in f7944026ee89ea348f89aec56372d6d25b6cafc1d89df741278d6917e86326a3
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52
@@ -2171,8 +2171,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 6ff9ecb89d769bc2a27f8a57130f28ec7478979d3e35ba765c16017b5bdf775d
-R 4bcc5da65154a62685074a5874c60e20
-U dan
-Z b3c584459b21dffccf981eba99e95d81
+P 1803cb9bb6a13fb66956f729066b6eae64c3a1c0715102fb1a9994e395c12ba9
+R 50be0ae2403a4de82fb245ed40141391
+U drh
+Z 3002323c72a643b625fa2973294110d0
 # Remove this line to create a well-formed Fossil manifest.
index 064022f860a4b2e389025f2690b86457b67767dc..872987abde64887fdbf3faea3fa24b4750978b53 100644 (file)
@@ -1 +1 @@
-1803cb9bb6a13fb66956f729066b6eae64c3a1c0715102fb1a9994e395c12ba9
+5daebf2d6013e73d89c9feb796e15b67c39577e5a9e9c86fa260995f4118f04b
index c74681e6437678d58532d9016932e36619b66cb6..bd20e1a4cce12cb761b8ff2de4a2ee1d4132b841 100644 (file)
@@ -1516,7 +1516,7 @@ struct ShellState {
   int inputNesting;      /* Track nesting level of .read and other redirects */
   int outCount;          /* Revert to stdout when reaching zero */
   int cnt;               /* Number of records displayed so far */
-  int lineno;            /* Line number of last line read from in */
+  i64 lineno;            /* Line number of last line read from in */
   int openFlags;         /* Additional flags to open.  (SQLITE_OPEN_NOFOLLOW) */
   FILE *in;              /* Read commands from this stream */
   FILE *out;             /* Write results here */
@@ -1752,7 +1752,7 @@ static void failIfSafeMode(
     va_start(ap, zErrMsg);
     zMsg = sqlite3_vmprintf(zErrMsg, ap);
     va_end(ap);
-    sqlite3_fprintf(stderr, "line %d: %s\n", p->lineno, zMsg);
+    sqlite3_fprintf(stderr, "line %lld: %s\n", p->lineno, zMsg);
     exit(1);
   }
 }
@@ -5709,7 +5709,7 @@ database_type_by_name:
 */
 static unsigned char *readHexDb(ShellState *p, int *pnData){
   unsigned char *a = 0;
-  int nLine;
+  i64 nLine;
   int n = 0;                      /* Size of db per first line of hex dump */
   i64 sz = 0;                     /* n rounded up to nearest page boundary */
   int pgsz = 0;
@@ -5790,7 +5790,7 @@ readHexDb_error:
     p->lineno = nLine;
   }
   sqlite3_free(a);
-  sqlite3_fprintf(stderr,"Error on line %d of --hexdb input\n", nLine);
+  sqlite3_fprintf(stderr,"Error on line %lld of --hexdb input\n", nLine);
   return 0;
 }
 #endif /* SQLITE_OMIT_DESERIALIZE */
@@ -9570,7 +9570,7 @@ static int do_meta_command(char *zLine, ShellState *p){
     ImportCtx sCtx;             /* Reader context */
     char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
     int eVerbose = 0;           /* Larger for more console output */
-    int nSkip = 0;              /* Initial lines to skip */
+    i64 nSkip = 0;              /* Initial lines to skip */
     int useOutputMode = 1;      /* Use output mode to determine separators */
     char *zCreate = 0;          /* CREATE TABLE statement text */
 
@@ -10295,7 +10295,7 @@ static int do_meta_command(char *zLine, ShellState *p){
       eputz("Usage: .nonce NONCE\n");
       rc = 1;
     }else if( p->zNonce==0 || cli_strcmp(azArg[1],p->zNonce)!=0 ){
-      sqlite3_fprintf(stderr,"line %d: incorrect nonce: \"%s\"\n",
+      sqlite3_fprintf(stderr,"line %lld: incorrect nonce: \"%s\"\n",
             p->lineno, azArg[1]);
       exit(1);
     }else{
@@ -10754,7 +10754,7 @@ static int do_meta_command(char *zLine, ShellState *p){
 #ifndef SQLITE_SHELL_FIDDLE
   if( c=='r' && n>=3 && cli_strncmp(azArg[0], "read", n)==0 ){
     FILE *inSaved = p->in;
-    int savedLineno = p->lineno;
+    i64 savedLineno = p->lineno;
     failIfSafeMode(p, "cannot run .read in safe mode");
     if( nArg!=2 ){
       eputz("Usage: .read FILE\n");
@@ -12783,7 +12783,7 @@ static int process_input(ShellState *p, const char *zSrc){
 
   if( p->inputNesting==MAX_INPUT_NESTING ){
     /* This will be more informative in a later version. */
-    sqlite3_fprintf(stderr,"%s: Input nesting limit (%d) reached at line %d."
+    sqlite3_fprintf(stderr,"%s: Input nesting limit (%d) reached at line %lld."
           " Check recursion.\n", zSrc, MAX_INPUT_NESTING, p->lineno);
     return 1;
   }
@@ -13025,7 +13025,7 @@ static void process_sqliterc(
   char *home_dir = NULL;
   char *sqliterc = (char*)sqliterc_override;
   FILE *inSaved = p->in;
-  int savedLineno = p->lineno;
+  i64 savedLineno = p->lineno;
 
   if( sqliterc == NULL ){
     sqliterc = find_xdg_file("XDG_CONFIG_HOME",