/ Check-in [360c8ca1]
Login

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

Overview
Comment:Update documentation on sqlite3_config() and add corresponding evidence marks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 360c8ca11c3315c8e08c7c52ff5468e3f723e562
User & Date: drh 2014-11-07 01:43:56
Context
2014-11-07
11:39
Fix typo in sqlite3.h reported on the mailing list. check-in: 40270321 user: drh tags: trunk
01:43
Update documentation on sqlite3_config() and add corresponding evidence marks. check-in: 360c8ca1 user: drh tags: trunk
2014-11-06
14:43
Added SQLITE_SCANSTAT_SELECTID. Change the value returned by SQLITE_SCANSTAT_EST from sqlite3_int64 to double. Enhanced the formatting and display of scan statistics using the ".scanstats on" command in the shell. check-in: 20c7614a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

   453    453         if( sqlite3GlobalConfig.pcache2.xInit==0 ){
   454    454           sqlite3PCacheSetDefault();
   455    455         }
   456    456         *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
   457    457         break;
   458    458       }
   459    459   
          460  +/* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only
          461  +** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or
          462  +** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */
   460    463   #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
   461    464       case SQLITE_CONFIG_HEAP: {
   462    465         /* EVIDENCE-OF: R-19854-42126 There are three arguments to
   463    466         ** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the
   464    467         ** number of bytes in the memory buffer, and the minimum allocation size. */
   465    468         sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
   466    469         sqlite3GlobalConfig.nHeap = va_arg(ap, int);
................................................................................
   470    473           sqlite3GlobalConfig.mnReq = 1;
   471    474         }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){
   472    475           /* cap min request size at 2^12 */
   473    476           sqlite3GlobalConfig.mnReq = (1<<12);
   474    477         }
   475    478   
   476    479         if( sqlite3GlobalConfig.pHeap==0 ){
   477         -        /* If the heap pointer is NULL, then restore the malloc implementation
   478         -        ** back to NULL pointers too.  This will cause the malloc to go
   479         -        ** back to its default implementation when sqlite3_initialize() is
   480         -        ** run.
          480  +        /* EVIDENCE-OF: R-49920-60189 If the first pointer (the memory pointer)
          481  +        ** is NULL, then SQLite reverts to using its default memory allocator
          482  +        ** (the system malloc() implementation), undoing any prior invocation of
          483  +        ** SQLITE_CONFIG_MALLOC.
          484  +        **
          485  +        ** Setting sqlite3GlobalConfig.m to all zeros will cause malloc to
          486  +        ** revert to its default implementation when sqlite3_initialize() is run
   481    487           */
   482    488           memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));
   483    489         }else{
   484         -        /* The heap pointer is not NULL, then install one of the
   485         -        ** mem5.c/mem3.c methods.  The enclosing #if guarantees at
   486         -        ** least one of these methods is currently enabled.
   487         -        */
          490  +        /* EVIDENCE-OF: R-61006-08918 If the memory pointer is not NULL then the
          491  +        ** alternative memory allocator is engaged to handle all of SQLites
          492  +        ** memory allocation needs. */
   488    493   #ifdef SQLITE_ENABLE_MEMSYS3
   489    494           sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();
   490    495   #endif
   491    496   #ifdef SQLITE_ENABLE_MEMSYS5
   492    497           sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();
   493    498   #endif
   494    499         }
................................................................................
   553    558         /* EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit
   554    559         ** integer (sqlite3_int64) values that are the default mmap size limit
   555    560         ** (the default setting for PRAGMA mmap_size) and the maximum allowed
   556    561         ** mmap size limit. */
   557    562         sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
   558    563         sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
   559    564         /* EVIDENCE-OF: R-53367-43190 If either argument to this option is
   560         -      ** negative, then that argument is changed to its compile-time default. */
          565  +      ** negative, then that argument is changed to its compile-time default.
          566  +      **
          567  +      ** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be
          568  +      ** silently truncated if necessary so that it does not exceed the
          569  +      ** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE
          570  +      ** compile-time option.
          571  +      */
   561    572         if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ) mxMmap = SQLITE_MAX_MMAP_SIZE;
   562    573         if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
   563    574         if( szMmap>mxMmap) szMmap = mxMmap;
   564    575         sqlite3GlobalConfig.mxMmap = mxMmap;
   565    576         sqlite3GlobalConfig.szMmap = szMmap;
   566    577         break;
   567    578       }
................................................................................
  2385   2396     const char *zVfs = zDefaultVfs;
  2386   2397     char *zFile;
  2387   2398     char c;
  2388   2399     int nUri = sqlite3Strlen30(zUri);
  2389   2400   
  2390   2401     assert( *pzErrMsg==0 );
  2391   2402   
  2392         -  if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri) 
         2403  +  if( ((flags & SQLITE_OPEN_URI)             /* IMP: R-48725-32206 */
         2404  +            || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
  2393   2405      && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
  2394   2406     ){
  2395   2407       char *zOpt;
  2396   2408       int eState;                   /* Parser state when parsing URI */
  2397   2409       int iIn;                      /* Input character index */
  2398   2410       int iOut = 0;                 /* Output character index */
  2399   2411       int nByte = nUri+2;           /* Bytes of space to allocate */

Changes to src/sqlite.h.in.

  1578   1578   ** page cache memory is needed beyond what is provided by this option, then
  1579   1579   ** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
  1580   1580   **
  1581   1581   ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
  1582   1582   ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer 
  1583   1583   ** that SQLite will use for all of its dynamic memory allocation needs
  1584   1584   ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
         1585  +** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
         1586  +** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
         1587  +** [SQLITE_ERROR] if invoked otherwise.
  1585   1588   ** ^There are three arguments to SQLITE_CONFIG_HEAP:
  1586   1589   ** An 8-byte aligned pointer to the memory,
  1587   1590   ** the number of bytes in the memory buffer, and the minimum allocation size.
  1588   1591   ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
  1589   1592   ** to using its default memory allocator (the system malloc() implementation),
  1590   1593   ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the
  1591         -** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
  1592         -** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
         1594  +** memory pointer is not NULL then the alternative memory
  1593   1595   ** allocator is engaged to handle all of SQLites memory allocation needs.
  1594   1596   ** The first pointer (the memory pointer) must be aligned to an 8-byte
  1595   1597   ** boundary or subsequent behavior of SQLite will be undefined.
  1596   1598   ** The minimum allocation size is capped at 2**12. Reasonable values
  1597   1599   ** for the minimum allocation size are 2**5 through 2**8.</dd>
  1598   1600   **
  1599   1601   ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
................................................................................
  1715   1717   ** <dt>SQLITE_CONFIG_MMAP_SIZE
  1716   1718   ** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
  1717   1719   ** that are the default mmap size limit (the default setting for
  1718   1720   ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
  1719   1721   ** ^The default setting can be overridden by each database connection using
  1720   1722   ** either the [PRAGMA mmap_size] command, or by using the
  1721   1723   ** [SQLITE_FCNTL_MMAP_SIZE] file control.  ^(The maximum allowed mmap size
  1722         -** cannot be changed at run-time.  Nor may the maximum allowed mmap size
  1723         -** exceed the compile-time maximum mmap size set by the
         1724  +** will be silently truncated if necessary so that it does not exceed the
         1725  +** compile-time maximum mmap size set by the
  1724   1726   ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
  1725   1727   ** ^If either argument to this option is negative, then that argument is
  1726   1728   ** changed to its compile-time default.
  1727   1729   **
  1728   1730   ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
  1729   1731   ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
  1730   1732   ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is