| | @@ -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 | | -** 724f2299f206cc9e7f830f984c50a8fc4ac1 with changes in files: |
| 21 | +** c1aa52361b8ede611f64b96f2394174389ce with changes in files: |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| | @@ -467,14 +467,14 @@ |
| 467 | 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | 469 | */ |
| 470 | 470 | #define SQLITE_VERSION "3.51.0" |
| 471 | 471 | #define SQLITE_VERSION_NUMBER 3051000 |
| 472 | | -#define SQLITE_SOURCE_ID "2025-10-28 13:24:50 724f2299f206cc9e7f830f984c50a8fc4ac1c17210d71d9affe657b45252b060" |
| 472 | +#define SQLITE_SOURCE_ID "2025-10-31 13:44:51 c1aa52361b8ede611f64b96f2394174389ce531b1d86b9cfec91d3b03c94f6ea" |
| 473 | 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | 474 | #define SQLITE_SCM_TAGS "" |
| 475 | | -#define SQLITE_SCM_DATETIME "2025-10-28T13:24:50.858Z" |
| 475 | +#define SQLITE_SCM_DATETIME "2025-10-31T13:44:51.646Z" |
| 476 | 476 | |
| 477 | 477 | /* |
| 478 | 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | 480 | ** |
| | @@ -24373,12 +24373,11 @@ |
| 24373 | 24373 | Mem oldipk; /* Memory cell holding "old" IPK value */ |
| 24374 | 24374 | Mem *aNew; /* Array of new.* values */ |
| 24375 | 24375 | Table *pTab; /* Schema object being updated */ |
| 24376 | 24376 | Index *pPk; /* PK index if pTab is WITHOUT ROWID */ |
| 24377 | 24377 | sqlite3_value **apDflt; /* Array of default values, if required */ |
| 24378 | | - union { |
| 24379 | | - KeyInfo sKey; |
| 24378 | + struct { |
| 24380 | 24379 | u8 keyinfoSpace[SZ_KEYINFO_0]; /* Space to hold pKeyinfo[0] content */ |
| 24381 | 24380 | } uKey; |
| 24382 | 24381 | }; |
| 24383 | 24382 | |
| 24384 | 24383 | /* |
| | @@ -41031,12 +41030,16 @@ |
| 41031 | 41030 | rc = osSetPosixAdvisoryLock(pFile->h, pLock, pFile); |
| 41032 | 41031 | } |
| 41033 | 41032 | return rc; |
| 41034 | 41033 | } |
| 41035 | 41034 | |
| 41035 | +#if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL) |
| 41036 | 41036 | /* Forward reference */ |
| 41037 | 41037 | static int unixIsSharingShmNode(unixFile*); |
| 41038 | +#else |
| 41039 | +#define unixIsSharingShmNode(pFile) (0) |
| 41040 | +#endif |
| 41038 | 41041 | |
| 41039 | 41042 | /* |
| 41040 | 41043 | ** Lock the file with the lock specified by parameter eFileLock - one |
| 41041 | 41044 | ** of the following: |
| 41042 | 41045 | ** |
| | @@ -44465,11 +44468,11 @@ |
| 44465 | 44468 | |
| 44466 | 44469 | assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) ); |
| 44467 | 44470 | return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0); |
| 44468 | 44471 | #endif |
| 44469 | 44472 | } |
| 44470 | | -#endif |
| 44473 | +#endif /* !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL) */ |
| 44471 | 44474 | |
| 44472 | 44475 | /* |
| 44473 | 44476 | ** Change the lock state for a shared-memory segment. |
| 44474 | 44477 | ** |
| 44475 | 44478 | ** Note that the relationship between SHARED and EXCLUSIVE locks is a little |
| | @@ -50449,10 +50452,11 @@ |
| 50449 | 50452 | #endif |
| 50450 | 50453 | } |
| 50451 | 50454 | #endif |
| 50452 | 50455 | } |
| 50453 | 50456 | |
| 50457 | +#ifndef SQLITE_OMIT_WAL |
| 50454 | 50458 | /* |
| 50455 | 50459 | ** Lock a region of nByte bytes starting at offset offset of file hFile. |
| 50456 | 50460 | ** Take an EXCLUSIVE lock if parameter bExclusive is true, or a SHARED lock |
| 50457 | 50461 | ** otherwise. If nMs is greater than zero and the lock cannot be obtained |
| 50458 | 50462 | ** immediately, block for that many ms before giving up. |
| | @@ -50531,10 +50535,11 @@ |
| 50531 | 50535 | if( rc==SQLITE_OK && !ret ){ |
| 50532 | 50536 | rc = SQLITE_BUSY; |
| 50533 | 50537 | } |
| 50534 | 50538 | return rc; |
| 50535 | 50539 | } |
| 50540 | +#endif /* #ifndef SQLITE_OMIT_WAL */ |
| 50536 | 50541 | |
| 50537 | 50542 | /* |
| 50538 | 50543 | ** Unlock a file region. |
| 50539 | 50544 | */ |
| 50540 | 50545 | static BOOL winUnlockFile( |
| | @@ -50565,17 +50570,19 @@ |
| 50565 | 50570 | #endif |
| 50566 | 50571 | } |
| 50567 | 50572 | #endif |
| 50568 | 50573 | } |
| 50569 | 50574 | |
| 50575 | +#ifndef SQLITE_OMIT_WAL |
| 50570 | 50576 | /* |
| 50571 | 50577 | ** Remove an nByte lock starting at offset iOff from HANDLE h. |
| 50572 | 50578 | */ |
| 50573 | 50579 | static int winHandleUnlock(HANDLE h, int iOff, int nByte){ |
| 50574 | 50580 | BOOL ret = winUnlockFile(&h, iOff, 0, nByte, 0); |
| 50575 | 50581 | return (ret ? SQLITE_OK : SQLITE_IOERR_UNLOCK); |
| 50576 | 50582 | } |
| 50583 | +#endif |
| 50577 | 50584 | |
| 50578 | 50585 | /***************************************************************************** |
| 50579 | 50586 | ** The next group of routines implement the I/O methods specified |
| 50580 | 50587 | ** by the sqlite3_io_methods object. |
| 50581 | 50588 | ******************************************************************************/ |
| | @@ -50909,10 +50916,11 @@ |
| 50909 | 50916 | OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n", |
| 50910 | 50917 | osGetCurrentProcessId(), pFile, pFile->h)); |
| 50911 | 50918 | return SQLITE_OK; |
| 50912 | 50919 | } |
| 50913 | 50920 | |
| 50921 | +#ifndef SQLITE_OMIT_WAL |
| 50914 | 50922 | /* |
| 50915 | 50923 | ** Truncate the file opened by handle h to nByte bytes in size. |
| 50916 | 50924 | */ |
| 50917 | 50925 | static int winHandleTruncate(HANDLE h, sqlite3_int64 nByte){ |
| 50918 | 50926 | int rc = SQLITE_OK; /* Return code */ |
| | @@ -50962,10 +50970,11 @@ |
| 50962 | 50970 | static void winHandleClose(HANDLE h){ |
| 50963 | 50971 | if( h!=INVALID_HANDLE_VALUE ){ |
| 50964 | 50972 | osCloseHandle(h); |
| 50965 | 50973 | } |
| 50966 | 50974 | } |
| 50975 | +#endif /* #ifndef SQLITE_OMIT_WAL */ |
| 50967 | 50976 | |
| 50968 | 50977 | /* |
| 50969 | 50978 | ** Truncate an open file to a specified size |
| 50970 | 50979 | */ |
| 50971 | 50980 | static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ |
| | @@ -60766,11 +60775,11 @@ |
| 60766 | 60775 | ** then the Wal object may be holding a write-lock but no read-lock. |
| 60767 | 60776 | ** This call ensures that the write-lock is dropped as well. We cannot |
| 60768 | 60777 | ** have sqlite3WalEndReadTransaction() drop the write-lock, as it once |
| 60769 | 60778 | ** did, because this would break "BEGIN EXCLUSIVE" handling for |
| 60770 | 60779 | ** SQLITE_ENABLE_SETLK_TIMEOUT builds. */ |
| 60771 | | - sqlite3WalEndWriteTransaction(pPager->pWal); |
| 60780 | + (void)sqlite3WalEndWriteTransaction(pPager->pWal); |
| 60772 | 60781 | } |
| 60773 | 60782 | sqlite3WalEndReadTransaction(pPager->pWal); |
| 60774 | 60783 | pPager->eState = PAGER_OPEN; |
| 60775 | 60784 | }else if( !pPager->exclusiveMode ){ |
| 60776 | 60785 | int rc; /* Error code returned by pagerUnlockDb() */ |
| | @@ -70231,11 +70240,11 @@ |
| 70231 | 70240 | SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){ |
| 70232 | 70241 | #ifndef SQLITE_ENABLE_SETLK_TIMEOUT |
| 70233 | 70242 | assert( pWal->writeLock==0 || pWal->readLock<0 ); |
| 70234 | 70243 | #endif |
| 70235 | 70244 | if( pWal->readLock>=0 ){ |
| 70236 | | - sqlite3WalEndWriteTransaction(pWal); |
| 70245 | + (void)sqlite3WalEndWriteTransaction(pWal); |
| 70237 | 70246 | walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock)); |
| 70238 | 70247 | pWal->readLock = -1; |
| 70239 | 70248 | } |
| 70240 | 70249 | } |
| 70241 | 70250 | |
| | @@ -71138,11 +71147,11 @@ |
| 71138 | 71147 | |
| 71139 | 71148 | walDisableBlocking(pWal); |
| 71140 | 71149 | sqlite3WalDb(pWal, 0); |
| 71141 | 71150 | |
| 71142 | 71151 | /* Release the locks. */ |
| 71143 | | - sqlite3WalEndWriteTransaction(pWal); |
| 71152 | + (void)sqlite3WalEndWriteTransaction(pWal); |
| 71144 | 71153 | if( pWal->ckptLock ){ |
| 71145 | 71154 | walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1); |
| 71146 | 71155 | pWal->ckptLock = 0; |
| 71147 | 71156 | } |
| 71148 | 71157 | WALTRACE(("WAL%p: checkpoint %s\n", pWal, rc ? "failed" : "ok")); |
| | @@ -85966,10 +85975,11 @@ |
| 85966 | 85975 | testcase( nAlloc==31 ); |
| 85967 | 85976 | testcase( nAlloc==32 ); |
| 85968 | 85977 | if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){ |
| 85969 | 85978 | return SQLITE_NOMEM_BKPT; |
| 85970 | 85979 | } |
| 85980 | + assert( pMem->z!=0 ); |
| 85971 | 85981 | memcpy(pMem->z, z, nAlloc); |
| 85972 | 85982 | }else{ |
| 85973 | 85983 | sqlite3VdbeMemRelease(pMem); |
| 85974 | 85984 | pMem->z = (char *)z; |
| 85975 | 85985 | if( xDel==SQLITE_DYNAMIC ){ |
| | @@ -92337,11 +92347,11 @@ |
| 92337 | 92347 | |
| 92338 | 92348 | preupdate.v = v; |
| 92339 | 92349 | preupdate.pCsr = pCsr; |
| 92340 | 92350 | preupdate.op = op; |
| 92341 | 92351 | preupdate.iNewReg = iReg; |
| 92342 | | - preupdate.pKeyinfo = &preupdate.uKey.sKey; |
| 92352 | + preupdate.pKeyinfo = (KeyInfo*)&preupdate.uKey; |
| 92343 | 92353 | preupdate.pKeyinfo->db = db; |
| 92344 | 92354 | preupdate.pKeyinfo->enc = ENC(db); |
| 92345 | 92355 | preupdate.pKeyinfo->nKeyField = pTab->nCol; |
| 92346 | 92356 | preupdate.pKeyinfo->aSortFlags = 0; /* Indicate .aColl, .nAllField uninit */ |
| 92347 | 92357 | preupdate.iKey1 = iKey1; |
| | @@ -116253,11 +116263,11 @@ |
| 116253 | 116263 | assert( pParse->pVdbe!=0 ); |
| 116254 | 116264 | v = pParse->pVdbe; |
| 116255 | 116265 | pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116256 | 116266 | if( pAlt!=pExpr ){ |
| 116257 | 116267 | r1 = sqlite3ExprCodeTarget(pParse, pAlt, target); |
| 116258 | | - sqlite3VdbeAddOp3(v, OP_BitAnd, r1, r1, target); |
| 116268 | + sqlite3VdbeAddOp3(v, OP_And, r1, r1, target); |
| 116259 | 116269 | return target; |
| 116260 | 116270 | } |
| 116261 | 116271 | skipOp = op==TK_AND ? OP_IfNot : OP_If; |
| 116262 | 116272 | if( exprEvalRhsFirst(pExpr) ){ |
| 116263 | 116273 | /* Compute the right operand first. Skip the computation of the left |
| | @@ -153547,10 +153557,11 @@ |
| 153547 | 153557 | nExtra++; /* One extra column for the OP_Sequence */ |
| 153548 | 153558 | } |
| 153549 | 153559 | if( pFunc->bOBPayload ){ |
| 153550 | 153560 | /* extra columns for the function arguments */ |
| 153551 | 153561 | assert( ExprUseXList(pFunc->pFExpr) ); |
| 153562 | + assert( pFunc->pFExpr->x.pList!=0 ); |
| 153552 | 153563 | nExtra += pFunc->pFExpr->x.pList->nExpr; |
| 153553 | 153564 | } |
| 153554 | 153565 | if( pFunc->bUseSubtype ){ |
| 153555 | 153566 | nExtra += pFunc->pFExpr->x.pList->nExpr; |
| 153556 | 153567 | } |
| | @@ -260266,11 +260277,11 @@ |
| 260266 | 260277 | int nArg, /* Number of args */ |
| 260267 | 260278 | sqlite3_value **apUnused /* Function arguments */ |
| 260268 | 260279 | ){ |
| 260269 | 260280 | assert( nArg==0 ); |
| 260270 | 260281 | UNUSED_PARAM2(nArg, apUnused); |
| 260271 | | - sqlite3_result_text(pCtx, "fts5: 2025-10-28 13:24:50 724f2299f206cc9e7f830f984c50a8fc4ac1c17210d71d9affe657b45252b060", -1, SQLITE_TRANSIENT); |
| 260282 | + sqlite3_result_text(pCtx, "fts5: 2025-10-30 11:39:49 c833f26a6780f919551e50c67d308e96293cec8481899354411d805617481f24", -1, SQLITE_TRANSIENT); |
| 260272 | 260283 | } |
| 260273 | 260284 | |
| 260274 | 260285 | /* |
| 260275 | 260286 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 260276 | 260287 | ** |
| 260277 | 260288 | |