Fossil SCM
Update the built-in SQLite to the 3.49.0 release.
Commit
935cd45f03304fed7358f1f07616aee67570f8ade39a62c057a68cebbf5de5b6
Parent
4799aaef7d1683b…
2 files changed
+93
-29
+30
-16
+93
-29
| --- extsrc/sqlite3.c | ||
| +++ extsrc/sqlite3.c | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | -** 4068f586ddadd3a818645574f7584fcee6d3 with changes in files: | |
| 21 | +** 4a7dd425dc2a0e5082a9049c9b4a9d4f199a with changes in files: | |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | ||
| 465 | 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | 467 | */ |
| 468 | 468 | #define SQLITE_VERSION "3.49.0" |
| 469 | 469 | #define SQLITE_VERSION_NUMBER 3049000 |
| 470 | -#define SQLITE_SOURCE_ID "2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a" | |
| 470 | +#define SQLITE_SOURCE_ID "2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde" | |
| 471 | 471 | |
| 472 | 472 | /* |
| 473 | 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | 475 | ** |
| @@ -2528,11 +2528,19 @@ | ||
| 2528 | 2528 | |
| 2529 | 2529 | /* |
| 2530 | 2530 | ** CAPI3REF: Database Connection Configuration Options |
| 2531 | 2531 | ** |
| 2532 | 2532 | ** These constants are the available integer configuration options that |
| 2533 | -** can be passed as the second argument to the [sqlite3_db_config()] interface. | |
| 2533 | +** can be passed as the second parameter to the [sqlite3_db_config()] interface. | |
| 2534 | +** | |
| 2535 | +** The [sqlite3_db_config()] interface is a var-args functions. It takes a | |
| 2536 | +** variable number of parameters, though always at least two. The number of | |
| 2537 | +** parameters passed into sqlite3_db_config() depends on which of these | |
| 2538 | +** constants is given as the second parameter. This documentation page | |
| 2539 | +** refers to parameters beyond the second as "arguments". Thus, when this | |
| 2540 | +** page says "the N-th argument" it means "the N-th parameter past the | |
| 2541 | +** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()". | |
| 2534 | 2542 | ** |
| 2535 | 2543 | ** New configuration options may be added in future releases of SQLite. |
| 2536 | 2544 | ** Existing configuration options might be discontinued. Applications |
| 2537 | 2545 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2538 | 2546 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2545,11 +2553,13 @@ | ||
| 2545 | 2553 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2546 | 2554 | ** configuration of the lookaside memory allocator within a database |
| 2547 | 2555 | ** connection. |
| 2548 | 2556 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2549 | 2557 | ** in the [DBCONFIG arguments|usual format]. |
| 2550 | -** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two. | |
| 2558 | +** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, | |
| 2559 | +** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE | |
| 2560 | +** should have a total of five parameters. | |
| 2551 | 2561 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2552 | 2562 | ** pointer to a memory buffer to use for lookaside memory. |
| 2553 | 2563 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2554 | 2564 | ** may be NULL in which case SQLite will allocate the |
| 2555 | 2565 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2647,16 +2657,17 @@ | ||
| 2647 | 2657 | ** |
| 2648 | 2658 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2649 | 2659 | ** <dd> ^This option is used to change the name of the "main" database |
| 2650 | 2660 | ** schema. This option does not follow the |
| 2651 | 2661 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2652 | -** This option takes exactly one argument, which ust be a pointer | |
| 2653 | -** to a constant UTF8 string which will become the new schema name | |
| 2654 | -** in place of "main". ^SQLite does not make a copy of the new main | |
| 2655 | -** schema name string, so the application must ensure that the argument | |
| 2656 | -** passed into SQLITE_DBCONFIG MAINDBNAME is unchanged | |
| 2657 | -** until after the database connection closes. | |
| 2662 | +** This option takes exactly one additional argument so that the | |
| 2663 | +** [sqlite3_db_config()] call has a total of three parameters. The | |
| 2664 | +** extra argument must be a pointer to a constant UTF8 string which | |
| 2665 | +** will become the new schema name in place of "main". ^SQLite does | |
| 2666 | +** not make a copy of the new main schema name string, so the application | |
| 2667 | +** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME | |
| 2668 | +** is unchanged until after the database connection closes. | |
| 2658 | 2669 | ** </dd> |
| 2659 | 2670 | ** |
| 2660 | 2671 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2661 | 2672 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2662 | 2673 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2663,14 +2674,15 @@ | ||
| 2663 | 2674 | ** database handle, SQLite checks if if there are other connections to the |
| 2664 | 2675 | ** same database, and if there are no other database connection (if the |
| 2665 | 2676 | ** connection being closed is the last open connection to the database), |
| 2666 | 2677 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2667 | 2678 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2668 | -** be used to override that behavior. The first parameter passed to this | |
| 2669 | -** operation is an integer - positive to disable checkpoints-on-close, or | |
| 2670 | -** zero (the default) to enable them, and negative to leave the setting unchanged. | |
| 2671 | -** The second parameter is a pointer to an integer | |
| 2679 | +** be used to override that behavior. The first argument passed to this | |
| 2680 | +** operation (the third parameter to [sqlite3_db_config()]) is an integer | |
| 2681 | +** which is positive to disable checkpoints-on-close, or zero (the default) | |
| 2682 | +** to enable them, and negative to leave the setting unchanged. | |
| 2683 | +** The second argument (the fourth parameter) is a pointer to an integer | |
| 2672 | 2684 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2673 | 2685 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2674 | 2686 | ** </dd> |
| 2675 | 2687 | ** |
| 2676 | 2688 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2904,13 +2916,15 @@ | ||
| 2904 | 2916 | ** |
| 2905 | 2917 | ** </dl> |
| 2906 | 2918 | ** |
| 2907 | 2919 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2908 | 2920 | ** |
| 2909 | -** <p>Most of the SQLITE_DBCONFIG options take two arguments: an integer | |
| 2910 | -** and a pointer to an integer. If the first integer argument is 1, then | |
| 2911 | -** the option becomes enabled. If the first integer argument is 0, then the | |
| 2921 | +** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the | |
| 2922 | +** overall call to [sqlite3_db_config()] has a total of four parameters. | |
| 2923 | +** The first argument (the third parameter to sqlite3_db_config()) is a integer. | |
| 2924 | +** The second argument is a pointer to an integer. If the first argument is 1, | |
| 2925 | +** then the option becomes enabled. If the first integer argument is 0, then the | |
| 2912 | 2926 | ** option is disabled. If the first argument is -1, then the option setting |
| 2913 | 2927 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2914 | 2928 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2915 | 2929 | ** the integer to which the second argument points, depending on whether the |
| 2916 | 2930 | ** setting is disabled or enabled after applying any changes specified by |
| @@ -20205,13 +20219,11 @@ | ||
| 20205 | 20219 | u8 eParseMode; /* PARSE_MODE_XXX constant */ |
| 20206 | 20220 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 20207 | 20221 | int nVtabLock; /* Number of virtual tables to lock */ |
| 20208 | 20222 | #endif |
| 20209 | 20223 | int nHeight; /* Expression tree height of current sub-select */ |
| 20210 | -#ifndef SQLITE_OMIT_EXPLAIN | |
| 20211 | 20224 | int addrExplain; /* Address of current OP_Explain opcode */ |
| 20212 | -#endif | |
| 20213 | 20225 | VList *pVList; /* Mapping between variable names and numbers */ |
| 20214 | 20226 | Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 20215 | 20227 | const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 20216 | 20228 | Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 20217 | 20229 | Index *pNewIndex; /* An index being constructed by CREATE INDEX. |
| @@ -131351,11 +131363,14 @@ | ||
| 131351 | 131363 | ** to initialize it */ |
| 131352 | 131364 | if( ALWAYS(p) && type!=SQLITE_NULL ){ |
| 131353 | 131365 | assert( p->cnt>0 ); |
| 131354 | 131366 | p->cnt--; |
| 131355 | 131367 | if( !p->approx ){ |
| 131356 | - p->iSum -= sqlite3_value_int64(argv[0]); | |
| 131368 | + if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){ | |
| 131369 | + p->ovrfl = 1; | |
| 131370 | + p->approx = 1; | |
| 131371 | + } | |
| 131357 | 131372 | }else if( type==SQLITE_INTEGER ){ |
| 131358 | 131373 | i64 iVal = sqlite3_value_int64(argv[0]); |
| 131359 | 131374 | if( iVal!=SMALLEST_INT64 ){ |
| 131360 | 131375 | kahanBabuskaNeumaierStepInt64(p, -iVal); |
| 131361 | 131376 | }else{ |
| @@ -188153,10 +188168,11 @@ | ||
| 188153 | 188168 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( |
| 188154 | 188169 | Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *); |
| 188155 | 188170 | SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); |
| 188156 | 188171 | SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); |
| 188157 | 188172 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); |
| 188173 | +SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor*, Fts3Expr*); | |
| 188158 | 188174 | |
| 188159 | 188175 | /* fts3_tokenize_vtab.c */ |
| 188160 | 188176 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*)); |
| 188161 | 188177 | |
| 188162 | 188178 | /* fts3_unicode2.c (functions generated by parsing unicode text files) */ |
| @@ -193670,10 +193686,28 @@ | ||
| 193670 | 193686 | |
| 193671 | 193687 | fts3EvalRestart(pCsr, pExpr->pLeft, pRc); |
| 193672 | 193688 | fts3EvalRestart(pCsr, pExpr->pRight, pRc); |
| 193673 | 193689 | } |
| 193674 | 193690 | } |
| 193691 | + | |
| 193692 | +/* | |
| 193693 | +** Expression node pExpr is an MSR phrase. This function restarts pExpr | |
| 193694 | +** so that it is a regular phrase query, not an MSR. SQLITE_OK is returned | |
| 193695 | +** if successful, or an SQLite error code otherwise. | |
| 193696 | +*/ | |
| 193697 | +SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor *pCsr, Fts3Expr *pExpr){ | |
| 193698 | + int rc = SQLITE_OK; | |
| 193699 | + if( pExpr->bEof==0 ){ | |
| 193700 | + i64 iDocid = pExpr->iDocid; | |
| 193701 | + fts3EvalRestart(pCsr, pExpr, &rc); | |
| 193702 | + while( rc==SQLITE_OK && pExpr->iDocid!=iDocid ){ | |
| 193703 | + fts3EvalNextRow(pCsr, pExpr, &rc); | |
| 193704 | + if( pExpr->bEof ) rc = FTS_CORRUPT_VTAB; | |
| 193705 | + } | |
| 193706 | + } | |
| 193707 | + return rc; | |
| 193708 | +} | |
| 193675 | 193709 | |
| 193676 | 193710 | /* |
| 193677 | 193711 | ** After allocating the Fts3Expr.aMI[] array for each phrase in the |
| 193678 | 193712 | ** expression rooted at pExpr, the cursor iterates through all rows matched |
| 193679 | 193713 | ** by pExpr, calling this function for each row. This function increments |
| @@ -205627,10 +205661,26 @@ | ||
| 205627 | 205661 | pT->iPos = iPos; |
| 205628 | 205662 | } |
| 205629 | 205663 | |
| 205630 | 205664 | return rc; |
| 205631 | 205665 | } |
| 205666 | + | |
| 205667 | +/* | |
| 205668 | +** If expression pExpr is a phrase expression that uses an MSR query, | |
| 205669 | +** restart it as a regular, non-incremental query. Return SQLITE_OK | |
| 205670 | +** if successful, or an SQLite error code otherwise. | |
| 205671 | +*/ | |
| 205672 | +static int fts3ExprRestartIfCb(Fts3Expr *pExpr, int iPhrase, void *ctx){ | |
| 205673 | + TermOffsetCtx *p = (TermOffsetCtx*)ctx; | |
| 205674 | + int rc = SQLITE_OK; | |
| 205675 | + UNUSED_PARAMETER(iPhrase); | |
| 205676 | + if( pExpr->pPhrase && pExpr->pPhrase->bIncr ){ | |
| 205677 | + rc = sqlite3Fts3MsrCancel(p->pCsr, pExpr); | |
| 205678 | + pExpr->pPhrase->bIncr = 0; | |
| 205679 | + } | |
| 205680 | + return rc; | |
| 205681 | +} | |
| 205632 | 205682 | |
| 205633 | 205683 | /* |
| 205634 | 205684 | ** Implementation of offsets() function. |
| 205635 | 205685 | */ |
| 205636 | 205686 | SQLITE_PRIVATE void sqlite3Fts3Offsets( |
| @@ -205663,10 +205713,16 @@ | ||
| 205663 | 205713 | rc = SQLITE_NOMEM; |
| 205664 | 205714 | goto offsets_out; |
| 205665 | 205715 | } |
| 205666 | 205716 | sCtx.iDocid = pCsr->iPrevId; |
| 205667 | 205717 | sCtx.pCsr = pCsr; |
| 205718 | + | |
| 205719 | + /* If a query restart will be required, do it here, rather than later of | |
| 205720 | + ** after pointers to poslist buffers that may be invalidated by a restart | |
| 205721 | + ** have been saved. */ | |
| 205722 | + rc = sqlite3Fts3ExprIterate(pCsr->pExpr, fts3ExprRestartIfCb, (void*)&sCtx); | |
| 205723 | + if( rc!=SQLITE_OK ) goto offsets_out; | |
| 205668 | 205724 | |
| 205669 | 205725 | /* Loop through the table columns, appending offset information to |
| 205670 | 205726 | ** string-buffer res for each column. |
| 205671 | 205727 | */ |
| 205672 | 205728 | for(iCol=0; iCol<pTab->nColumn; iCol++){ |
| @@ -229279,13 +229335,15 @@ | ||
| 229279 | 229335 | int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2; |
| 229280 | 229336 | if( 0==sessionBufferGrow(p, nStr, pRc) ){ |
| 229281 | 229337 | char *zOut = (char *)&p->aBuf[p->nBuf]; |
| 229282 | 229338 | const char *zIn = zStr; |
| 229283 | 229339 | *zOut++ = '"'; |
| 229284 | - while( *zIn ){ | |
| 229285 | - if( *zIn=='"' ) *zOut++ = '"'; | |
| 229286 | - *zOut++ = *(zIn++); | |
| 229340 | + if( zIn!=0 ){ | |
| 229341 | + while( *zIn ){ | |
| 229342 | + if( *zIn=='"' ) *zOut++ = '"'; | |
| 229343 | + *zOut++ = *(zIn++); | |
| 229344 | + } | |
| 229287 | 229345 | } |
| 229288 | 229346 | *zOut++ = '"'; |
| 229289 | 229347 | p->nBuf = (int)((u8 *)zOut - p->aBuf); |
| 229290 | 229348 | p->aBuf[p->nBuf] = 0x00; |
| 229291 | 229349 | } |
| @@ -248255,12 +248313,15 @@ | ||
| 248255 | 248313 | |
| 248256 | 248314 | /* |
| 248257 | 248315 | ** This is called as part of flushing a delete to disk in 'secure-delete' |
| 248258 | 248316 | ** mode. It edits the segments within the database described by argument |
| 248259 | 248317 | ** pStruct to remove the entries for term zTerm, rowid iRowid. |
| 248318 | +** | |
| 248319 | +** Return SQLITE_OK if successful, or an SQLite error code if an error | |
| 248320 | +** has occurred. Any error code is also stored in the Fts5Index handle. | |
| 248260 | 248321 | */ |
| 248261 | -static void fts5FlushSecureDelete( | |
| 248322 | +static int fts5FlushSecureDelete( | |
| 248262 | 248323 | Fts5Index *p, |
| 248263 | 248324 | Fts5Structure *pStruct, |
| 248264 | 248325 | const char *zTerm, |
| 248265 | 248326 | int nTerm, |
| 248266 | 248327 | i64 iRowid |
| @@ -248301,10 +248362,11 @@ | ||
| 248301 | 248362 | fts5DoSecureDelete(p, pSeg); |
| 248302 | 248363 | } |
| 248303 | 248364 | } |
| 248304 | 248365 | |
| 248305 | 248366 | fts5MultiIterFree(pIter); |
| 248367 | + return p->rc; | |
| 248306 | 248368 | } |
| 248307 | 248369 | |
| 248308 | 248370 | |
| 248309 | 248371 | /* |
| 248310 | 248372 | ** Flush the contents of in-memory hash table iHash to a new level-0 |
| @@ -248384,22 +248446,24 @@ | ||
| 248384 | 248446 | /* If in secure delete mode, and if this entry in the poslist is |
| 248385 | 248447 | ** in fact a delete, then edit the existing segments directly |
| 248386 | 248448 | ** using fts5FlushSecureDelete(). */ |
| 248387 | 248449 | if( bSecureDelete ){ |
| 248388 | 248450 | if( eDetail==FTS5_DETAIL_NONE ){ |
| 248389 | - if( iOff<nDoclist && pDoclist[iOff]==0x00 ){ | |
| 248390 | - fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid); | |
| 248451 | + if( iOff<nDoclist && pDoclist[iOff]==0x00 | |
| 248452 | + && !fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid) | |
| 248453 | + ){ | |
| 248391 | 248454 | iOff++; |
| 248392 | 248455 | if( iOff<nDoclist && pDoclist[iOff]==0x00 ){ |
| 248393 | 248456 | iOff++; |
| 248394 | 248457 | nDoclist = 0; |
| 248395 | 248458 | }else{ |
| 248396 | 248459 | continue; |
| 248397 | 248460 | } |
| 248398 | 248461 | } |
| 248399 | - }else if( (pDoclist[iOff] & 0x01) ){ | |
| 248400 | - fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid); | |
| 248462 | + }else if( (pDoclist[iOff] & 0x01) | |
| 248463 | + && !fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid) | |
| 248464 | + ){ | |
| 248401 | 248465 | if( p->rc!=SQLITE_OK || pDoclist[iOff]==0x01 ){ |
| 248402 | 248466 | iOff++; |
| 248403 | 248467 | continue; |
| 248404 | 248468 | } |
| 248405 | 248469 | } |
| @@ -255806,11 +255870,11 @@ | ||
| 255806 | 255870 | int nArg, /* Number of args */ |
| 255807 | 255871 | sqlite3_value **apUnused /* Function arguments */ |
| 255808 | 255872 | ){ |
| 255809 | 255873 | assert( nArg==0 ); |
| 255810 | 255874 | UNUSED_PARAM2(nArg, apUnused); |
| 255811 | - sqlite3_result_text(pCtx, "fts5: 2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a", -1, SQLITE_TRANSIENT); | |
| 255875 | + sqlite3_result_text(pCtx, "fts5: 2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde", -1, SQLITE_TRANSIENT); | |
| 255812 | 255876 | } |
| 255813 | 255877 | |
| 255814 | 255878 | /* |
| 255815 | 255879 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255816 | 255880 | ** |
| 255817 | 255881 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 4068f586ddadd3a818645574f7584fcee6d3 with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | |
| 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | */ |
| 468 | #define SQLITE_VERSION "3.49.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3049000 |
| 470 | #define SQLITE_SOURCE_ID "2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -2528,11 +2528,19 @@ | |
| 2528 | |
| 2529 | /* |
| 2530 | ** CAPI3REF: Database Connection Configuration Options |
| 2531 | ** |
| 2532 | ** These constants are the available integer configuration options that |
| 2533 | ** can be passed as the second argument to the [sqlite3_db_config()] interface. |
| 2534 | ** |
| 2535 | ** New configuration options may be added in future releases of SQLite. |
| 2536 | ** Existing configuration options might be discontinued. Applications |
| 2537 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2538 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2545,11 +2553,13 @@ | |
| 2545 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2546 | ** configuration of the lookaside memory allocator within a database |
| 2547 | ** connection. |
| 2548 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2549 | ** in the [DBCONFIG arguments|usual format]. |
| 2550 | ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two. |
| 2551 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2552 | ** pointer to a memory buffer to use for lookaside memory. |
| 2553 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2554 | ** may be NULL in which case SQLite will allocate the |
| 2555 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2647,16 +2657,17 @@ | |
| 2647 | ** |
| 2648 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2649 | ** <dd> ^This option is used to change the name of the "main" database |
| 2650 | ** schema. This option does not follow the |
| 2651 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2652 | ** This option takes exactly one argument, which ust be a pointer |
| 2653 | ** to a constant UTF8 string which will become the new schema name |
| 2654 | ** in place of "main". ^SQLite does not make a copy of the new main |
| 2655 | ** schema name string, so the application must ensure that the argument |
| 2656 | ** passed into SQLITE_DBCONFIG MAINDBNAME is unchanged |
| 2657 | ** until after the database connection closes. |
| 2658 | ** </dd> |
| 2659 | ** |
| 2660 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2661 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2662 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2663,14 +2674,15 @@ | |
| 2663 | ** database handle, SQLite checks if if there are other connections to the |
| 2664 | ** same database, and if there are no other database connection (if the |
| 2665 | ** connection being closed is the last open connection to the database), |
| 2666 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2667 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2668 | ** be used to override that behavior. The first parameter passed to this |
| 2669 | ** operation is an integer - positive to disable checkpoints-on-close, or |
| 2670 | ** zero (the default) to enable them, and negative to leave the setting unchanged. |
| 2671 | ** The second parameter is a pointer to an integer |
| 2672 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2673 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2674 | ** </dd> |
| 2675 | ** |
| 2676 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2904,13 +2916,15 @@ | |
| 2904 | ** |
| 2905 | ** </dl> |
| 2906 | ** |
| 2907 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2908 | ** |
| 2909 | ** <p>Most of the SQLITE_DBCONFIG options take two arguments: an integer |
| 2910 | ** and a pointer to an integer. If the first integer argument is 1, then |
| 2911 | ** the option becomes enabled. If the first integer argument is 0, then the |
| 2912 | ** option is disabled. If the first argument is -1, then the option setting |
| 2913 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2914 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2915 | ** the integer to which the second argument points, depending on whether the |
| 2916 | ** setting is disabled or enabled after applying any changes specified by |
| @@ -20205,13 +20219,11 @@ | |
| 20205 | u8 eParseMode; /* PARSE_MODE_XXX constant */ |
| 20206 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 20207 | int nVtabLock; /* Number of virtual tables to lock */ |
| 20208 | #endif |
| 20209 | int nHeight; /* Expression tree height of current sub-select */ |
| 20210 | #ifndef SQLITE_OMIT_EXPLAIN |
| 20211 | int addrExplain; /* Address of current OP_Explain opcode */ |
| 20212 | #endif |
| 20213 | VList *pVList; /* Mapping between variable names and numbers */ |
| 20214 | Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 20215 | const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 20216 | Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 20217 | Index *pNewIndex; /* An index being constructed by CREATE INDEX. |
| @@ -131351,11 +131363,14 @@ | |
| 131351 | ** to initialize it */ |
| 131352 | if( ALWAYS(p) && type!=SQLITE_NULL ){ |
| 131353 | assert( p->cnt>0 ); |
| 131354 | p->cnt--; |
| 131355 | if( !p->approx ){ |
| 131356 | p->iSum -= sqlite3_value_int64(argv[0]); |
| 131357 | }else if( type==SQLITE_INTEGER ){ |
| 131358 | i64 iVal = sqlite3_value_int64(argv[0]); |
| 131359 | if( iVal!=SMALLEST_INT64 ){ |
| 131360 | kahanBabuskaNeumaierStepInt64(p, -iVal); |
| 131361 | }else{ |
| @@ -188153,10 +188168,11 @@ | |
| 188153 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( |
| 188154 | Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *); |
| 188155 | SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); |
| 188156 | SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); |
| 188157 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); |
| 188158 | |
| 188159 | /* fts3_tokenize_vtab.c */ |
| 188160 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*)); |
| 188161 | |
| 188162 | /* fts3_unicode2.c (functions generated by parsing unicode text files) */ |
| @@ -193670,10 +193686,28 @@ | |
| 193670 | |
| 193671 | fts3EvalRestart(pCsr, pExpr->pLeft, pRc); |
| 193672 | fts3EvalRestart(pCsr, pExpr->pRight, pRc); |
| 193673 | } |
| 193674 | } |
| 193675 | |
| 193676 | /* |
| 193677 | ** After allocating the Fts3Expr.aMI[] array for each phrase in the |
| 193678 | ** expression rooted at pExpr, the cursor iterates through all rows matched |
| 193679 | ** by pExpr, calling this function for each row. This function increments |
| @@ -205627,10 +205661,26 @@ | |
| 205627 | pT->iPos = iPos; |
| 205628 | } |
| 205629 | |
| 205630 | return rc; |
| 205631 | } |
| 205632 | |
| 205633 | /* |
| 205634 | ** Implementation of offsets() function. |
| 205635 | */ |
| 205636 | SQLITE_PRIVATE void sqlite3Fts3Offsets( |
| @@ -205663,10 +205713,16 @@ | |
| 205663 | rc = SQLITE_NOMEM; |
| 205664 | goto offsets_out; |
| 205665 | } |
| 205666 | sCtx.iDocid = pCsr->iPrevId; |
| 205667 | sCtx.pCsr = pCsr; |
| 205668 | |
| 205669 | /* Loop through the table columns, appending offset information to |
| 205670 | ** string-buffer res for each column. |
| 205671 | */ |
| 205672 | for(iCol=0; iCol<pTab->nColumn; iCol++){ |
| @@ -229279,13 +229335,15 @@ | |
| 229279 | int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2; |
| 229280 | if( 0==sessionBufferGrow(p, nStr, pRc) ){ |
| 229281 | char *zOut = (char *)&p->aBuf[p->nBuf]; |
| 229282 | const char *zIn = zStr; |
| 229283 | *zOut++ = '"'; |
| 229284 | while( *zIn ){ |
| 229285 | if( *zIn=='"' ) *zOut++ = '"'; |
| 229286 | *zOut++ = *(zIn++); |
| 229287 | } |
| 229288 | *zOut++ = '"'; |
| 229289 | p->nBuf = (int)((u8 *)zOut - p->aBuf); |
| 229290 | p->aBuf[p->nBuf] = 0x00; |
| 229291 | } |
| @@ -248255,12 +248313,15 @@ | |
| 248255 | |
| 248256 | /* |
| 248257 | ** This is called as part of flushing a delete to disk in 'secure-delete' |
| 248258 | ** mode. It edits the segments within the database described by argument |
| 248259 | ** pStruct to remove the entries for term zTerm, rowid iRowid. |
| 248260 | */ |
| 248261 | static void fts5FlushSecureDelete( |
| 248262 | Fts5Index *p, |
| 248263 | Fts5Structure *pStruct, |
| 248264 | const char *zTerm, |
| 248265 | int nTerm, |
| 248266 | i64 iRowid |
| @@ -248301,10 +248362,11 @@ | |
| 248301 | fts5DoSecureDelete(p, pSeg); |
| 248302 | } |
| 248303 | } |
| 248304 | |
| 248305 | fts5MultiIterFree(pIter); |
| 248306 | } |
| 248307 | |
| 248308 | |
| 248309 | /* |
| 248310 | ** Flush the contents of in-memory hash table iHash to a new level-0 |
| @@ -248384,22 +248446,24 @@ | |
| 248384 | /* If in secure delete mode, and if this entry in the poslist is |
| 248385 | ** in fact a delete, then edit the existing segments directly |
| 248386 | ** using fts5FlushSecureDelete(). */ |
| 248387 | if( bSecureDelete ){ |
| 248388 | if( eDetail==FTS5_DETAIL_NONE ){ |
| 248389 | if( iOff<nDoclist && pDoclist[iOff]==0x00 ){ |
| 248390 | fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid); |
| 248391 | iOff++; |
| 248392 | if( iOff<nDoclist && pDoclist[iOff]==0x00 ){ |
| 248393 | iOff++; |
| 248394 | nDoclist = 0; |
| 248395 | }else{ |
| 248396 | continue; |
| 248397 | } |
| 248398 | } |
| 248399 | }else if( (pDoclist[iOff] & 0x01) ){ |
| 248400 | fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid); |
| 248401 | if( p->rc!=SQLITE_OK || pDoclist[iOff]==0x01 ){ |
| 248402 | iOff++; |
| 248403 | continue; |
| 248404 | } |
| 248405 | } |
| @@ -255806,11 +255870,11 @@ | |
| 255806 | int nArg, /* Number of args */ |
| 255807 | sqlite3_value **apUnused /* Function arguments */ |
| 255808 | ){ |
| 255809 | assert( nArg==0 ); |
| 255810 | UNUSED_PARAM2(nArg, apUnused); |
| 255811 | sqlite3_result_text(pCtx, "fts5: 2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a", -1, SQLITE_TRANSIENT); |
| 255812 | } |
| 255813 | |
| 255814 | /* |
| 255815 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255816 | ** |
| 255817 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 4a7dd425dc2a0e5082a9049c9b4a9d4f199a with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | |
| 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | */ |
| 468 | #define SQLITE_VERSION "3.49.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3049000 |
| 470 | #define SQLITE_SOURCE_ID "2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -2528,11 +2528,19 @@ | |
| 2528 | |
| 2529 | /* |
| 2530 | ** CAPI3REF: Database Connection Configuration Options |
| 2531 | ** |
| 2532 | ** These constants are the available integer configuration options that |
| 2533 | ** can be passed as the second parameter to the [sqlite3_db_config()] interface. |
| 2534 | ** |
| 2535 | ** The [sqlite3_db_config()] interface is a var-args functions. It takes a |
| 2536 | ** variable number of parameters, though always at least two. The number of |
| 2537 | ** parameters passed into sqlite3_db_config() depends on which of these |
| 2538 | ** constants is given as the second parameter. This documentation page |
| 2539 | ** refers to parameters beyond the second as "arguments". Thus, when this |
| 2540 | ** page says "the N-th argument" it means "the N-th parameter past the |
| 2541 | ** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()". |
| 2542 | ** |
| 2543 | ** New configuration options may be added in future releases of SQLite. |
| 2544 | ** Existing configuration options might be discontinued. Applications |
| 2545 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2546 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2545,11 +2553,13 @@ | |
| 2553 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2554 | ** configuration of the lookaside memory allocator within a database |
| 2555 | ** connection. |
| 2556 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2557 | ** in the [DBCONFIG arguments|usual format]. |
| 2558 | ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, |
| 2559 | ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE |
| 2560 | ** should have a total of five parameters. |
| 2561 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2562 | ** pointer to a memory buffer to use for lookaside memory. |
| 2563 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2564 | ** may be NULL in which case SQLite will allocate the |
| 2565 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2647,16 +2657,17 @@ | |
| 2657 | ** |
| 2658 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2659 | ** <dd> ^This option is used to change the name of the "main" database |
| 2660 | ** schema. This option does not follow the |
| 2661 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2662 | ** This option takes exactly one additional argument so that the |
| 2663 | ** [sqlite3_db_config()] call has a total of three parameters. The |
| 2664 | ** extra argument must be a pointer to a constant UTF8 string which |
| 2665 | ** will become the new schema name in place of "main". ^SQLite does |
| 2666 | ** not make a copy of the new main schema name string, so the application |
| 2667 | ** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME |
| 2668 | ** is unchanged until after the database connection closes. |
| 2669 | ** </dd> |
| 2670 | ** |
| 2671 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2672 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2673 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2663,14 +2674,15 @@ | |
| 2674 | ** database handle, SQLite checks if if there are other connections to the |
| 2675 | ** same database, and if there are no other database connection (if the |
| 2676 | ** connection being closed is the last open connection to the database), |
| 2677 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2678 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2679 | ** be used to override that behavior. The first argument passed to this |
| 2680 | ** operation (the third parameter to [sqlite3_db_config()]) is an integer |
| 2681 | ** which is positive to disable checkpoints-on-close, or zero (the default) |
| 2682 | ** to enable them, and negative to leave the setting unchanged. |
| 2683 | ** The second argument (the fourth parameter) is a pointer to an integer |
| 2684 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2685 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2686 | ** </dd> |
| 2687 | ** |
| 2688 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2904,13 +2916,15 @@ | |
| 2916 | ** |
| 2917 | ** </dl> |
| 2918 | ** |
| 2919 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2920 | ** |
| 2921 | ** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the |
| 2922 | ** overall call to [sqlite3_db_config()] has a total of four parameters. |
| 2923 | ** The first argument (the third parameter to sqlite3_db_config()) is a integer. |
| 2924 | ** The second argument is a pointer to an integer. If the first argument is 1, |
| 2925 | ** then the option becomes enabled. If the first integer argument is 0, then the |
| 2926 | ** option is disabled. If the first argument is -1, then the option setting |
| 2927 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2928 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2929 | ** the integer to which the second argument points, depending on whether the |
| 2930 | ** setting is disabled or enabled after applying any changes specified by |
| @@ -20205,13 +20219,11 @@ | |
| 20219 | u8 eParseMode; /* PARSE_MODE_XXX constant */ |
| 20220 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 20221 | int nVtabLock; /* Number of virtual tables to lock */ |
| 20222 | #endif |
| 20223 | int nHeight; /* Expression tree height of current sub-select */ |
| 20224 | int addrExplain; /* Address of current OP_Explain opcode */ |
| 20225 | VList *pVList; /* Mapping between variable names and numbers */ |
| 20226 | Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 20227 | const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 20228 | Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 20229 | Index *pNewIndex; /* An index being constructed by CREATE INDEX. |
| @@ -131351,11 +131363,14 @@ | |
| 131363 | ** to initialize it */ |
| 131364 | if( ALWAYS(p) && type!=SQLITE_NULL ){ |
| 131365 | assert( p->cnt>0 ); |
| 131366 | p->cnt--; |
| 131367 | if( !p->approx ){ |
| 131368 | if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){ |
| 131369 | p->ovrfl = 1; |
| 131370 | p->approx = 1; |
| 131371 | } |
| 131372 | }else if( type==SQLITE_INTEGER ){ |
| 131373 | i64 iVal = sqlite3_value_int64(argv[0]); |
| 131374 | if( iVal!=SMALLEST_INT64 ){ |
| 131375 | kahanBabuskaNeumaierStepInt64(p, -iVal); |
| 131376 | }else{ |
| @@ -188153,10 +188168,11 @@ | |
| 188168 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( |
| 188169 | Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *); |
| 188170 | SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); |
| 188171 | SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); |
| 188172 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); |
| 188173 | SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor*, Fts3Expr*); |
| 188174 | |
| 188175 | /* fts3_tokenize_vtab.c */ |
| 188176 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*)); |
| 188177 | |
| 188178 | /* fts3_unicode2.c (functions generated by parsing unicode text files) */ |
| @@ -193670,10 +193686,28 @@ | |
| 193686 | |
| 193687 | fts3EvalRestart(pCsr, pExpr->pLeft, pRc); |
| 193688 | fts3EvalRestart(pCsr, pExpr->pRight, pRc); |
| 193689 | } |
| 193690 | } |
| 193691 | |
| 193692 | /* |
| 193693 | ** Expression node pExpr is an MSR phrase. This function restarts pExpr |
| 193694 | ** so that it is a regular phrase query, not an MSR. SQLITE_OK is returned |
| 193695 | ** if successful, or an SQLite error code otherwise. |
| 193696 | */ |
| 193697 | SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor *pCsr, Fts3Expr *pExpr){ |
| 193698 | int rc = SQLITE_OK; |
| 193699 | if( pExpr->bEof==0 ){ |
| 193700 | i64 iDocid = pExpr->iDocid; |
| 193701 | fts3EvalRestart(pCsr, pExpr, &rc); |
| 193702 | while( rc==SQLITE_OK && pExpr->iDocid!=iDocid ){ |
| 193703 | fts3EvalNextRow(pCsr, pExpr, &rc); |
| 193704 | if( pExpr->bEof ) rc = FTS_CORRUPT_VTAB; |
| 193705 | } |
| 193706 | } |
| 193707 | return rc; |
| 193708 | } |
| 193709 | |
| 193710 | /* |
| 193711 | ** After allocating the Fts3Expr.aMI[] array for each phrase in the |
| 193712 | ** expression rooted at pExpr, the cursor iterates through all rows matched |
| 193713 | ** by pExpr, calling this function for each row. This function increments |
| @@ -205627,10 +205661,26 @@ | |
| 205661 | pT->iPos = iPos; |
| 205662 | } |
| 205663 | |
| 205664 | return rc; |
| 205665 | } |
| 205666 | |
| 205667 | /* |
| 205668 | ** If expression pExpr is a phrase expression that uses an MSR query, |
| 205669 | ** restart it as a regular, non-incremental query. Return SQLITE_OK |
| 205670 | ** if successful, or an SQLite error code otherwise. |
| 205671 | */ |
| 205672 | static int fts3ExprRestartIfCb(Fts3Expr *pExpr, int iPhrase, void *ctx){ |
| 205673 | TermOffsetCtx *p = (TermOffsetCtx*)ctx; |
| 205674 | int rc = SQLITE_OK; |
| 205675 | UNUSED_PARAMETER(iPhrase); |
| 205676 | if( pExpr->pPhrase && pExpr->pPhrase->bIncr ){ |
| 205677 | rc = sqlite3Fts3MsrCancel(p->pCsr, pExpr); |
| 205678 | pExpr->pPhrase->bIncr = 0; |
| 205679 | } |
| 205680 | return rc; |
| 205681 | } |
| 205682 | |
| 205683 | /* |
| 205684 | ** Implementation of offsets() function. |
| 205685 | */ |
| 205686 | SQLITE_PRIVATE void sqlite3Fts3Offsets( |
| @@ -205663,10 +205713,16 @@ | |
| 205713 | rc = SQLITE_NOMEM; |
| 205714 | goto offsets_out; |
| 205715 | } |
| 205716 | sCtx.iDocid = pCsr->iPrevId; |
| 205717 | sCtx.pCsr = pCsr; |
| 205718 | |
| 205719 | /* If a query restart will be required, do it here, rather than later of |
| 205720 | ** after pointers to poslist buffers that may be invalidated by a restart |
| 205721 | ** have been saved. */ |
| 205722 | rc = sqlite3Fts3ExprIterate(pCsr->pExpr, fts3ExprRestartIfCb, (void*)&sCtx); |
| 205723 | if( rc!=SQLITE_OK ) goto offsets_out; |
| 205724 | |
| 205725 | /* Loop through the table columns, appending offset information to |
| 205726 | ** string-buffer res for each column. |
| 205727 | */ |
| 205728 | for(iCol=0; iCol<pTab->nColumn; iCol++){ |
| @@ -229279,13 +229335,15 @@ | |
| 229335 | int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2; |
| 229336 | if( 0==sessionBufferGrow(p, nStr, pRc) ){ |
| 229337 | char *zOut = (char *)&p->aBuf[p->nBuf]; |
| 229338 | const char *zIn = zStr; |
| 229339 | *zOut++ = '"'; |
| 229340 | if( zIn!=0 ){ |
| 229341 | while( *zIn ){ |
| 229342 | if( *zIn=='"' ) *zOut++ = '"'; |
| 229343 | *zOut++ = *(zIn++); |
| 229344 | } |
| 229345 | } |
| 229346 | *zOut++ = '"'; |
| 229347 | p->nBuf = (int)((u8 *)zOut - p->aBuf); |
| 229348 | p->aBuf[p->nBuf] = 0x00; |
| 229349 | } |
| @@ -248255,12 +248313,15 @@ | |
| 248313 | |
| 248314 | /* |
| 248315 | ** This is called as part of flushing a delete to disk in 'secure-delete' |
| 248316 | ** mode. It edits the segments within the database described by argument |
| 248317 | ** pStruct to remove the entries for term zTerm, rowid iRowid. |
| 248318 | ** |
| 248319 | ** Return SQLITE_OK if successful, or an SQLite error code if an error |
| 248320 | ** has occurred. Any error code is also stored in the Fts5Index handle. |
| 248321 | */ |
| 248322 | static int fts5FlushSecureDelete( |
| 248323 | Fts5Index *p, |
| 248324 | Fts5Structure *pStruct, |
| 248325 | const char *zTerm, |
| 248326 | int nTerm, |
| 248327 | i64 iRowid |
| @@ -248301,10 +248362,11 @@ | |
| 248362 | fts5DoSecureDelete(p, pSeg); |
| 248363 | } |
| 248364 | } |
| 248365 | |
| 248366 | fts5MultiIterFree(pIter); |
| 248367 | return p->rc; |
| 248368 | } |
| 248369 | |
| 248370 | |
| 248371 | /* |
| 248372 | ** Flush the contents of in-memory hash table iHash to a new level-0 |
| @@ -248384,22 +248446,24 @@ | |
| 248446 | /* If in secure delete mode, and if this entry in the poslist is |
| 248447 | ** in fact a delete, then edit the existing segments directly |
| 248448 | ** using fts5FlushSecureDelete(). */ |
| 248449 | if( bSecureDelete ){ |
| 248450 | if( eDetail==FTS5_DETAIL_NONE ){ |
| 248451 | if( iOff<nDoclist && pDoclist[iOff]==0x00 |
| 248452 | && !fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid) |
| 248453 | ){ |
| 248454 | iOff++; |
| 248455 | if( iOff<nDoclist && pDoclist[iOff]==0x00 ){ |
| 248456 | iOff++; |
| 248457 | nDoclist = 0; |
| 248458 | }else{ |
| 248459 | continue; |
| 248460 | } |
| 248461 | } |
| 248462 | }else if( (pDoclist[iOff] & 0x01) |
| 248463 | && !fts5FlushSecureDelete(p, pStruct, zTerm, nTerm, iRowid) |
| 248464 | ){ |
| 248465 | if( p->rc!=SQLITE_OK || pDoclist[iOff]==0x01 ){ |
| 248466 | iOff++; |
| 248467 | continue; |
| 248468 | } |
| 248469 | } |
| @@ -255806,11 +255870,11 @@ | |
| 255870 | int nArg, /* Number of args */ |
| 255871 | sqlite3_value **apUnused /* Function arguments */ |
| 255872 | ){ |
| 255873 | assert( nArg==0 ); |
| 255874 | UNUSED_PARAM2(nArg, apUnused); |
| 255875 | sqlite3_result_text(pCtx, "fts5: 2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde", -1, SQLITE_TRANSIENT); |
| 255876 | } |
| 255877 | |
| 255878 | /* |
| 255879 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255880 | ** |
| 255881 |
+30
-16
| --- extsrc/sqlite3.h | ||
| +++ extsrc/sqlite3.h | ||
| @@ -146,11 +146,11 @@ | ||
| 146 | 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | 148 | */ |
| 149 | 149 | #define SQLITE_VERSION "3.49.0" |
| 150 | 150 | #define SQLITE_VERSION_NUMBER 3049000 |
| 151 | -#define SQLITE_SOURCE_ID "2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a" | |
| 151 | +#define SQLITE_SOURCE_ID "2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde" | |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | 156 | ** |
| @@ -2209,11 +2209,19 @@ | ||
| 2209 | 2209 | |
| 2210 | 2210 | /* |
| 2211 | 2211 | ** CAPI3REF: Database Connection Configuration Options |
| 2212 | 2212 | ** |
| 2213 | 2213 | ** These constants are the available integer configuration options that |
| 2214 | -** can be passed as the second argument to the [sqlite3_db_config()] interface. | |
| 2214 | +** can be passed as the second parameter to the [sqlite3_db_config()] interface. | |
| 2215 | +** | |
| 2216 | +** The [sqlite3_db_config()] interface is a var-args functions. It takes a | |
| 2217 | +** variable number of parameters, though always at least two. The number of | |
| 2218 | +** parameters passed into sqlite3_db_config() depends on which of these | |
| 2219 | +** constants is given as the second parameter. This documentation page | |
| 2220 | +** refers to parameters beyond the second as "arguments". Thus, when this | |
| 2221 | +** page says "the N-th argument" it means "the N-th parameter past the | |
| 2222 | +** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()". | |
| 2215 | 2223 | ** |
| 2216 | 2224 | ** New configuration options may be added in future releases of SQLite. |
| 2217 | 2225 | ** Existing configuration options might be discontinued. Applications |
| 2218 | 2226 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2219 | 2227 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2226,11 +2234,13 @@ | ||
| 2226 | 2234 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2227 | 2235 | ** configuration of the lookaside memory allocator within a database |
| 2228 | 2236 | ** connection. |
| 2229 | 2237 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2230 | 2238 | ** in the [DBCONFIG arguments|usual format]. |
| 2231 | -** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two. | |
| 2239 | +** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, | |
| 2240 | +** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE | |
| 2241 | +** should have a total of five parameters. | |
| 2232 | 2242 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2233 | 2243 | ** pointer to a memory buffer to use for lookaside memory. |
| 2234 | 2244 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2235 | 2245 | ** may be NULL in which case SQLite will allocate the |
| 2236 | 2246 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2328,16 +2338,17 @@ | ||
| 2328 | 2338 | ** |
| 2329 | 2339 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2330 | 2340 | ** <dd> ^This option is used to change the name of the "main" database |
| 2331 | 2341 | ** schema. This option does not follow the |
| 2332 | 2342 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2333 | -** This option takes exactly one argument, which ust be a pointer | |
| 2334 | -** to a constant UTF8 string which will become the new schema name | |
| 2335 | -** in place of "main". ^SQLite does not make a copy of the new main | |
| 2336 | -** schema name string, so the application must ensure that the argument | |
| 2337 | -** passed into SQLITE_DBCONFIG MAINDBNAME is unchanged | |
| 2338 | -** until after the database connection closes. | |
| 2343 | +** This option takes exactly one additional argument so that the | |
| 2344 | +** [sqlite3_db_config()] call has a total of three parameters. The | |
| 2345 | +** extra argument must be a pointer to a constant UTF8 string which | |
| 2346 | +** will become the new schema name in place of "main". ^SQLite does | |
| 2347 | +** not make a copy of the new main schema name string, so the application | |
| 2348 | +** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME | |
| 2349 | +** is unchanged until after the database connection closes. | |
| 2339 | 2350 | ** </dd> |
| 2340 | 2351 | ** |
| 2341 | 2352 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2342 | 2353 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2343 | 2354 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2344,14 +2355,15 @@ | ||
| 2344 | 2355 | ** database handle, SQLite checks if if there are other connections to the |
| 2345 | 2356 | ** same database, and if there are no other database connection (if the |
| 2346 | 2357 | ** connection being closed is the last open connection to the database), |
| 2347 | 2358 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2348 | 2359 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2349 | -** be used to override that behavior. The first parameter passed to this | |
| 2350 | -** operation is an integer - positive to disable checkpoints-on-close, or | |
| 2351 | -** zero (the default) to enable them, and negative to leave the setting unchanged. | |
| 2352 | -** The second parameter is a pointer to an integer | |
| 2360 | +** be used to override that behavior. The first argument passed to this | |
| 2361 | +** operation (the third parameter to [sqlite3_db_config()]) is an integer | |
| 2362 | +** which is positive to disable checkpoints-on-close, or zero (the default) | |
| 2363 | +** to enable them, and negative to leave the setting unchanged. | |
| 2364 | +** The second argument (the fourth parameter) is a pointer to an integer | |
| 2353 | 2365 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2354 | 2366 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2355 | 2367 | ** </dd> |
| 2356 | 2368 | ** |
| 2357 | 2369 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2585,13 +2597,15 @@ | ||
| 2585 | 2597 | ** |
| 2586 | 2598 | ** </dl> |
| 2587 | 2599 | ** |
| 2588 | 2600 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2589 | 2601 | ** |
| 2590 | -** <p>Most of the SQLITE_DBCONFIG options take two arguments: an integer | |
| 2591 | -** and a pointer to an integer. If the first integer argument is 1, then | |
| 2592 | -** the option becomes enabled. If the first integer argument is 0, then the | |
| 2602 | +** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the | |
| 2603 | +** overall call to [sqlite3_db_config()] has a total of four parameters. | |
| 2604 | +** The first argument (the third parameter to sqlite3_db_config()) is a integer. | |
| 2605 | +** The second argument is a pointer to an integer. If the first argument is 1, | |
| 2606 | +** then the option becomes enabled. If the first integer argument is 0, then the | |
| 2593 | 2607 | ** option is disabled. If the first argument is -1, then the option setting |
| 2594 | 2608 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2595 | 2609 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2596 | 2610 | ** the integer to which the second argument points, depending on whether the |
| 2597 | 2611 | ** setting is disabled or enabled after applying any changes specified by |
| 2598 | 2612 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,11 +146,11 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.49.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3049000 |
| 151 | #define SQLITE_SOURCE_ID "2025-02-01 23:49:01 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| @@ -2209,11 +2209,19 @@ | |
| 2209 | |
| 2210 | /* |
| 2211 | ** CAPI3REF: Database Connection Configuration Options |
| 2212 | ** |
| 2213 | ** These constants are the available integer configuration options that |
| 2214 | ** can be passed as the second argument to the [sqlite3_db_config()] interface. |
| 2215 | ** |
| 2216 | ** New configuration options may be added in future releases of SQLite. |
| 2217 | ** Existing configuration options might be discontinued. Applications |
| 2218 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2219 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2226,11 +2234,13 @@ | |
| 2226 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2227 | ** configuration of the lookaside memory allocator within a database |
| 2228 | ** connection. |
| 2229 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2230 | ** in the [DBCONFIG arguments|usual format]. |
| 2231 | ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two. |
| 2232 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2233 | ** pointer to a memory buffer to use for lookaside memory. |
| 2234 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2235 | ** may be NULL in which case SQLite will allocate the |
| 2236 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2328,16 +2338,17 @@ | |
| 2328 | ** |
| 2329 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2330 | ** <dd> ^This option is used to change the name of the "main" database |
| 2331 | ** schema. This option does not follow the |
| 2332 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2333 | ** This option takes exactly one argument, which ust be a pointer |
| 2334 | ** to a constant UTF8 string which will become the new schema name |
| 2335 | ** in place of "main". ^SQLite does not make a copy of the new main |
| 2336 | ** schema name string, so the application must ensure that the argument |
| 2337 | ** passed into SQLITE_DBCONFIG MAINDBNAME is unchanged |
| 2338 | ** until after the database connection closes. |
| 2339 | ** </dd> |
| 2340 | ** |
| 2341 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2342 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2343 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2344,14 +2355,15 @@ | |
| 2344 | ** database handle, SQLite checks if if there are other connections to the |
| 2345 | ** same database, and if there are no other database connection (if the |
| 2346 | ** connection being closed is the last open connection to the database), |
| 2347 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2348 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2349 | ** be used to override that behavior. The first parameter passed to this |
| 2350 | ** operation is an integer - positive to disable checkpoints-on-close, or |
| 2351 | ** zero (the default) to enable them, and negative to leave the setting unchanged. |
| 2352 | ** The second parameter is a pointer to an integer |
| 2353 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2354 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2355 | ** </dd> |
| 2356 | ** |
| 2357 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2585,13 +2597,15 @@ | |
| 2585 | ** |
| 2586 | ** </dl> |
| 2587 | ** |
| 2588 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2589 | ** |
| 2590 | ** <p>Most of the SQLITE_DBCONFIG options take two arguments: an integer |
| 2591 | ** and a pointer to an integer. If the first integer argument is 1, then |
| 2592 | ** the option becomes enabled. If the first integer argument is 0, then the |
| 2593 | ** option is disabled. If the first argument is -1, then the option setting |
| 2594 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2595 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2596 | ** the integer to which the second argument points, depending on whether the |
| 2597 | ** setting is disabled or enabled after applying any changes specified by |
| 2598 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,11 +146,11 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.49.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3049000 |
| 151 | #define SQLITE_SOURCE_ID "2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| @@ -2209,11 +2209,19 @@ | |
| 2209 | |
| 2210 | /* |
| 2211 | ** CAPI3REF: Database Connection Configuration Options |
| 2212 | ** |
| 2213 | ** These constants are the available integer configuration options that |
| 2214 | ** can be passed as the second parameter to the [sqlite3_db_config()] interface. |
| 2215 | ** |
| 2216 | ** The [sqlite3_db_config()] interface is a var-args functions. It takes a |
| 2217 | ** variable number of parameters, though always at least two. The number of |
| 2218 | ** parameters passed into sqlite3_db_config() depends on which of these |
| 2219 | ** constants is given as the second parameter. This documentation page |
| 2220 | ** refers to parameters beyond the second as "arguments". Thus, when this |
| 2221 | ** page says "the N-th argument" it means "the N-th parameter past the |
| 2222 | ** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()". |
| 2223 | ** |
| 2224 | ** New configuration options may be added in future releases of SQLite. |
| 2225 | ** Existing configuration options might be discontinued. Applications |
| 2226 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2227 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| @@ -2226,11 +2234,13 @@ | |
| 2234 | ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2235 | ** configuration of the lookaside memory allocator within a database |
| 2236 | ** connection. |
| 2237 | ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2238 | ** in the [DBCONFIG arguments|usual format]. |
| 2239 | ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, |
| 2240 | ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE |
| 2241 | ** should have a total of five parameters. |
| 2242 | ** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2243 | ** pointer to a memory buffer to use for lookaside memory. |
| 2244 | ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2245 | ** may be NULL in which case SQLite will allocate the |
| 2246 | ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| @@ -2328,16 +2338,17 @@ | |
| 2338 | ** |
| 2339 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2340 | ** <dd> ^This option is used to change the name of the "main" database |
| 2341 | ** schema. This option does not follow the |
| 2342 | ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2343 | ** This option takes exactly one additional argument so that the |
| 2344 | ** [sqlite3_db_config()] call has a total of three parameters. The |
| 2345 | ** extra argument must be a pointer to a constant UTF8 string which |
| 2346 | ** will become the new schema name in place of "main". ^SQLite does |
| 2347 | ** not make a copy of the new main schema name string, so the application |
| 2348 | ** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME |
| 2349 | ** is unchanged until after the database connection closes. |
| 2350 | ** </dd> |
| 2351 | ** |
| 2352 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2353 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2354 | ** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| @@ -2344,14 +2355,15 @@ | |
| 2355 | ** database handle, SQLite checks if if there are other connections to the |
| 2356 | ** same database, and if there are no other database connection (if the |
| 2357 | ** connection being closed is the last open connection to the database), |
| 2358 | ** then SQLite performs a [checkpoint] before closing the connection and |
| 2359 | ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2360 | ** be used to override that behavior. The first argument passed to this |
| 2361 | ** operation (the third parameter to [sqlite3_db_config()]) is an integer |
| 2362 | ** which is positive to disable checkpoints-on-close, or zero (the default) |
| 2363 | ** to enable them, and negative to leave the setting unchanged. |
| 2364 | ** The second argument (the fourth parameter) is a pointer to an integer |
| 2365 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2366 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2367 | ** </dd> |
| 2368 | ** |
| 2369 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| @@ -2585,13 +2597,15 @@ | |
| 2597 | ** |
| 2598 | ** </dl> |
| 2599 | ** |
| 2600 | ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2601 | ** |
| 2602 | ** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the |
| 2603 | ** overall call to [sqlite3_db_config()] has a total of four parameters. |
| 2604 | ** The first argument (the third parameter to sqlite3_db_config()) is a integer. |
| 2605 | ** The second argument is a pointer to an integer. If the first argument is 1, |
| 2606 | ** then the option becomes enabled. If the first integer argument is 0, then the |
| 2607 | ** option is disabled. If the first argument is -1, then the option setting |
| 2608 | ** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2609 | ** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2610 | ** the integer to which the second argument points, depending on whether the |
| 2611 | ** setting is disabled or enabled after applying any changes specified by |
| 2612 |