/ Check-in [7adb789f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:A new approach to very large sqlite3_mprintf() strings: Back out the [d655a665] check-in and instead make the size fields in StrAccum unsigned. Strings generated by sqlite3_mprintf() can now be as large as 2^31-1 bytes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7adb789f45698e5569b840d23f3f9488db3ed109
User & Date: drh 2016-01-04 12:07:27
Context
2016-01-04
13:06
Fix the conflict2.test module which was broken by check-in [e30062e9f6c]. check-in: b779ca8a user: drh tags: trunk
12:07
A new approach to very large sqlite3_mprintf() strings: Back out the [d655a665] check-in and instead make the size fields in StrAccum unsigned. Strings generated by sqlite3_mprintf() can now be as large as 2^31-1 bytes. check-in: 7adb789f user: drh tags: trunk
04:44
Improved comment on the vtabH-3.1 test. check-in: 22abe080 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/printf.c.

   961    961       (void)SQLITE_MISUSE_BKPT;
   962    962       return 0;
   963    963     }
   964    964   #endif
   965    965   #ifndef SQLITE_OMIT_AUTOINIT
   966    966     if( sqlite3_initialize() ) return 0;
   967    967   #endif
   968         -#if SQLITE_MAX_LENGTH<0x40000000
   969    968     sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
   970         -#else
   971         -  sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), 0x3fffffff);
   972         -#endif
   973         -
   974    969     sqlite3VXPrintf(&acc, 0, zFormat, ap);
   975    970     z = sqlite3StrAccumFinish(&acc);
   976    971     return z;
   977    972   }
   978    973   
   979    974   /*
   980    975   ** Print into memory obtained from sqlite3_malloc()().  Omit the internal

Changes to src/sqliteInt.h.

  2960   2960   ** An objected used to accumulate the text of a string where we
  2961   2961   ** do not necessarily know how big the string will be in the end.
  2962   2962   */
  2963   2963   struct StrAccum {
  2964   2964     sqlite3 *db;         /* Optional database for lookaside.  Can be NULL */
  2965   2965     char *zBase;         /* A base allocation.  Not from malloc. */
  2966   2966     char *zText;         /* The string collected so far */
  2967         -  int  nChar;          /* Length of the string so far */
  2968         -  int  nAlloc;         /* Amount of space allocated in zText */
  2969         -  int  mxAlloc;        /* Maximum allowed allocation.  0 for no malloc usage */
         2967  +  u32  nChar;          /* Length of the string so far */
         2968  +  u32  nAlloc;         /* Amount of space allocated in zText */
         2969  +  u32  mxAlloc;        /* Maximum allowed allocation.  0 for no malloc usage */
  2970   2970     u8   accError;       /* STRACCUM_NOMEM or STRACCUM_TOOBIG */
  2971   2971     u8   bMalloced;      /* zText points to allocated space */
  2972   2972   };
  2973   2973   #define STRACCUM_NOMEM   1
  2974   2974   #define STRACCUM_TOOBIG  2
  2975   2975   
  2976   2976   /*

Changes to test/analyzeF.test.

   102    102   proc throw_error {err} { error $err }
   103    103   db func error -deterministic throw_error
   104    104   do_catchsql_test 4.1 {
   105    105     SELECT * FROM t1 WHERE x = error('error one') AND y = 4;
   106    106   } {1 {error one}}
   107    107   
   108    108   do_catchsql_test 4.2 {
   109         -  SELECT * FROM t1 WHERE x = zeroblob(2000000000) AND y = 4;
          109  +  SELECT * FROM t1 WHERE x = zeroblob(2200000000) AND y = 4;
   110    110   } {1 {string or blob too big}}
   111    111   
   112    112   sqlite3_limit db SQLITE_LIMIT_LENGTH 1000000
   113    113   proc dstr {} { return [string repeat x 1100000] }
   114    114   db func dstr -deterministic dstr
   115    115   do_catchsql_test 4.3 {
   116    116     SELECT * FROM t1 WHERE x = dstr() AND y = 11;
................................................................................
   118    118   
   119    119   do_catchsql_test 4.4 {
   120    120     SELECT * FROM t1 WHERE x = test_zeroblob(1100000) AND y = 4;
   121    121   } {1 {string or blob too big}}
   122    122   
   123    123   
   124    124   finish_test
   125         -
   126         -
   127         -