Fossil SCM
Update the built-in SQLite to the latest trunk version for testing.
Commit
1b55133f9ea3a54863f853d3a8bef142c5aa68743e3fbd4c910ea9620b4b75a7
Parent
f4f395b6a4e37ea…
2 files changed
+191
-178
+1
-1
+191
-178
| --- 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 | -** e2bae4143afd07de1ae55a6d2606a3b541a5 with changes in files: | |
| 21 | +** e6c30ee52c5cdc193804cec63374d558b45e 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.48.0" |
| 469 | 469 | #define SQLITE_VERSION_NUMBER 3048000 |
| 470 | -#define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653" | |
| 470 | +#define SQLITE_SOURCE_ID "2024-12-19 19:02:09 e6c30ee52c5cdc193804cec63374d558b45e4d67fc6bde58771ca78485ca0acf" | |
| 471 | 471 | |
| 472 | 472 | /* |
| 473 | 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | 475 | ** |
| @@ -14046,13 +14046,17 @@ | ||
| 14046 | 14046 | # define SQLITE_MAX_VDBE_OP 250000000 |
| 14047 | 14047 | #endif |
| 14048 | 14048 | |
| 14049 | 14049 | /* |
| 14050 | 14050 | ** The maximum number of arguments to an SQL function. |
| 14051 | +** | |
| 14052 | +** This value has a hard upper limit of 32767 due to storage | |
| 14053 | +** constraints (it needs to fit inside a i16). We keep it | |
| 14054 | +** lower than that to prevent abuse. | |
| 14051 | 14055 | */ |
| 14052 | 14056 | #ifndef SQLITE_MAX_FUNCTION_ARG |
| 14053 | -# define SQLITE_MAX_FUNCTION_ARG 127 | |
| 14057 | +# define SQLITE_MAX_FUNCTION_ARG 1000 | |
| 14054 | 14058 | #endif |
| 14055 | 14059 | |
| 14056 | 14060 | /* |
| 14057 | 14061 | ** The suggested maximum number of in-memory pages to use for |
| 14058 | 14062 | ** the main database table and for temporary tables. |
| @@ -16049,10 +16053,26 @@ | ||
| 16049 | 16053 | #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ |
| 16050 | 16054 | #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ |
| 16051 | 16055 | #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ |
| 16052 | 16056 | #define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ |
| 16053 | 16057 | #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ |
| 16058 | + | |
| 16059 | +#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL) | |
| 16060 | + | |
| 16061 | +/* | |
| 16062 | +** The argument to this macro is a file descriptor (type sqlite3_file*). | |
| 16063 | +** Return 0 if it is not open, or non-zero (but not 1) if it is. | |
| 16064 | +** | |
| 16065 | +** This is so that expressions can be written as: | |
| 16066 | +** | |
| 16067 | +** if( isOpen(pPager->jfd) ){ ... | |
| 16068 | +** | |
| 16069 | +** instead of | |
| 16070 | +** | |
| 16071 | +** if( pPager->jfd->pMethods ){ ... | |
| 16072 | +*/ | |
| 16073 | +#define isOpen(pFd) ((pFd)->pMethods!=0) | |
| 16054 | 16074 | |
| 16055 | 16075 | /* |
| 16056 | 16076 | ** Flags that make up the mask passed to sqlite3PagerGet(). |
| 16057 | 16077 | */ |
| 16058 | 16078 | #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ |
| @@ -18113,11 +18133,11 @@ | ||
| 18113 | 18133 | ** |
| 18114 | 18134 | ** The u.pHash field is used by the global built-ins. The u.pDestructor |
| 18115 | 18135 | ** field is used by per-connection app-def functions. |
| 18116 | 18136 | */ |
| 18117 | 18137 | struct FuncDef { |
| 18118 | - i8 nArg; /* Number of arguments. -1 means unlimited */ | |
| 18138 | + i16 nArg; /* Number of arguments. -1 means unlimited */ | |
| 18119 | 18139 | u32 funcFlags; /* Some combination of SQLITE_FUNC_* */ |
| 18120 | 18140 | void *pUserData; /* User data parameter */ |
| 18121 | 18141 | FuncDef *pNext; /* Next function with same name */ |
| 18122 | 18142 | void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */ |
| 18123 | 18143 | void (*xFinalize)(sqlite3_context*); /* Agg finalizer */ |
| @@ -23708,11 +23728,11 @@ | ||
| 23708 | 23728 | Vdbe *pVdbe; /* The VM that owns this context */ |
| 23709 | 23729 | int iOp; /* Instruction number of OP_Function */ |
| 23710 | 23730 | int isError; /* Error code returned by the function. */ |
| 23711 | 23731 | u8 enc; /* Encoding to use for results */ |
| 23712 | 23732 | u8 skipFlag; /* Skip accumulator loading if true */ |
| 23713 | - u8 argc; /* Number of arguments */ | |
| 23733 | + u16 argc; /* Number of arguments */ | |
| 23714 | 23734 | sqlite3_value *argv[1]; /* Argument set */ |
| 23715 | 23735 | }; |
| 23716 | 23736 | |
| 23717 | 23737 | /* A bitfield type for use inside of structures. Always follow with :N where |
| 23718 | 23738 | ** N is the number of bits. |
| @@ -58014,24 +58034,10 @@ | ||
| 58014 | 58034 | # define USEFETCH(x) ((x)->bUseFetch) |
| 58015 | 58035 | #else |
| 58016 | 58036 | # define USEFETCH(x) 0 |
| 58017 | 58037 | #endif |
| 58018 | 58038 | |
| 58019 | -/* | |
| 58020 | -** The argument to this macro is a file descriptor (type sqlite3_file*). | |
| 58021 | -** Return 0 if it is not open, or non-zero (but not 1) if it is. | |
| 58022 | -** | |
| 58023 | -** This is so that expressions can be written as: | |
| 58024 | -** | |
| 58025 | -** if( isOpen(pPager->jfd) ){ ... | |
| 58026 | -** | |
| 58027 | -** instead of | |
| 58028 | -** | |
| 58029 | -** if( pPager->jfd->pMethods ){ ... | |
| 58030 | -*/ | |
| 58031 | -#define isOpen(pFd) ((pFd)->pMethods!=0) | |
| 58032 | - | |
| 58033 | 58039 | #ifdef SQLITE_DIRECT_OVERFLOW_READ |
| 58034 | 58040 | /* |
| 58035 | 58041 | ** Return true if page pgno can be read directly from the database file |
| 58036 | 58042 | ** by the b-tree layer. This is the case if: |
| 58037 | 58043 | ** |
| @@ -59313,11 +59319,11 @@ | ||
| 59313 | 59319 | rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); |
| 59314 | 59320 | } |
| 59315 | 59321 | } |
| 59316 | 59322 | pPager->journalOff = 0; |
| 59317 | 59323 | }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST |
| 59318 | - || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL) | |
| 59324 | + || (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL) | |
| 59319 | 59325 | ){ |
| 59320 | 59326 | rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile); |
| 59321 | 59327 | pPager->journalOff = 0; |
| 59322 | 59328 | }else{ |
| 59323 | 59329 | /* This branch may be executed with Pager.journalMode==MEMORY if |
| @@ -68023,15 +68029,11 @@ | ||
| 68023 | 68029 | ** so it takes care to hold an exclusive lock on the corresponding |
| 68024 | 68030 | ** WAL_READ_LOCK() while changing values. |
| 68025 | 68031 | */ |
| 68026 | 68032 | static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ |
| 68027 | 68033 | volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ |
| 68028 | - u32 mxReadMark; /* Largest aReadMark[] value */ | |
| 68029 | - int mxI; /* Index of largest aReadMark[] value */ | |
| 68030 | - int i; /* Loop counter */ | |
| 68031 | 68034 | int rc = SQLITE_OK; /* Return code */ |
| 68032 | - u32 mxFrame; /* Wal frame to lock to */ | |
| 68033 | 68035 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68034 | 68036 | int nBlockTmout = 0; |
| 68035 | 68037 | #endif |
| 68036 | 68038 | |
| 68037 | 68039 | assert( pWal->readLock<0 ); /* Not currently locked */ |
| @@ -68133,145 +68135,151 @@ | ||
| 68133 | 68135 | |
| 68134 | 68136 | assert( pWal->nWiData>0 ); |
| 68135 | 68137 | assert( pWal->apWiData[0]!=0 ); |
| 68136 | 68138 | pInfo = walCkptInfo(pWal); |
| 68137 | 68139 | SEH_INJECT_FAULT; |
| 68138 | - if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame | |
| 68139 | -#ifdef SQLITE_ENABLE_SNAPSHOT | |
| 68140 | - && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) | |
| 68141 | -#endif | |
| 68142 | - ){ | |
| 68143 | - /* The WAL has been completely backfilled (or it is empty). | |
| 68144 | - ** and can be safely ignored. | |
| 68145 | - */ | |
| 68146 | - rc = walLockShared(pWal, WAL_READ_LOCK(0)); | |
| 68147 | - walShmBarrier(pWal); | |
| 68148 | - if( rc==SQLITE_OK ){ | |
| 68149 | - if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){ | |
| 68150 | - /* It is not safe to allow the reader to continue here if frames | |
| 68151 | - ** may have been appended to the log before READ_LOCK(0) was obtained. | |
| 68152 | - ** When holding READ_LOCK(0), the reader ignores the entire log file, | |
| 68153 | - ** which implies that the database file contains a trustworthy | |
| 68154 | - ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from | |
| 68155 | - ** happening, this is usually correct. | |
| 68156 | - ** | |
| 68157 | - ** However, if frames have been appended to the log (or if the log | |
| 68158 | - ** is wrapped and written for that matter) before the READ_LOCK(0) | |
| 68159 | - ** is obtained, that is not necessarily true. A checkpointer may | |
| 68160 | - ** have started to backfill the appended frames but crashed before | |
| 68161 | - ** it finished. Leaving a corrupt image in the database file. | |
| 68162 | - */ | |
| 68163 | - walUnlockShared(pWal, WAL_READ_LOCK(0)); | |
| 68164 | - return WAL_RETRY; | |
| 68165 | - } | |
| 68166 | - pWal->readLock = 0; | |
| 68167 | - return SQLITE_OK; | |
| 68168 | - }else if( rc!=SQLITE_BUSY ){ | |
| 68169 | - return rc; | |
| 68170 | - } | |
| 68171 | - } | |
| 68172 | - | |
| 68173 | - /* If we get this far, it means that the reader will want to use | |
| 68174 | - ** the WAL to get at content from recent commits. The job now is | |
| 68175 | - ** to select one of the aReadMark[] entries that is closest to | |
| 68176 | - ** but not exceeding pWal->hdr.mxFrame and lock that entry. | |
| 68177 | - */ | |
| 68178 | - mxReadMark = 0; | |
| 68179 | - mxI = 0; | |
| 68180 | - mxFrame = pWal->hdr.mxFrame; | |
| 68181 | -#ifdef SQLITE_ENABLE_SNAPSHOT | |
| 68182 | - if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ | |
| 68183 | - mxFrame = pWal->pSnapshot->mxFrame; | |
| 68184 | - } | |
| 68185 | -#endif | |
| 68186 | - for(i=1; i<WAL_NREADER; i++){ | |
| 68187 | - u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; | |
| 68188 | - if( mxReadMark<=thisMark && thisMark<=mxFrame ){ | |
| 68189 | - assert( thisMark!=READMARK_NOT_USED ); | |
| 68190 | - mxReadMark = thisMark; | |
| 68191 | - mxI = i; | |
| 68192 | - } | |
| 68193 | - } | |
| 68194 | - if( (pWal->readOnly & WAL_SHM_RDONLY)==0 | |
| 68195 | - && (mxReadMark<mxFrame || mxI==0) | |
| 68196 | - ){ | |
| 68197 | - for(i=1; i<WAL_NREADER; i++){ | |
| 68198 | - rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); | |
| 68199 | - if( rc==SQLITE_OK ){ | |
| 68200 | - AtomicStore(pInfo->aReadMark+i,mxFrame); | |
| 68201 | - mxReadMark = mxFrame; | |
| 68202 | - mxI = i; | |
| 68203 | - walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); | |
| 68204 | - break; | |
| 68205 | - }else if( rc!=SQLITE_BUSY ){ | |
| 68206 | - return rc; | |
| 68207 | - } | |
| 68208 | - } | |
| 68209 | - } | |
| 68210 | - if( mxI==0 ){ | |
| 68211 | - assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); | |
| 68212 | - return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; | |
| 68213 | - } | |
| 68214 | - | |
| 68215 | - (void)walEnableBlockingMs(pWal, nBlockTmout); | |
| 68216 | - rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); | |
| 68217 | - walDisableBlocking(pWal); | |
| 68218 | - if( rc ){ | |
| 68219 | -#ifdef SQLITE_ENABLE_SETLK_TIMEOUT | |
| 68220 | - if( rc==SQLITE_BUSY_TIMEOUT ){ | |
| 68221 | - *pCnt |= WAL_RETRY_BLOCKED_MASK; | |
| 68222 | - } | |
| 68223 | -#else | |
| 68224 | - assert( rc!=SQLITE_BUSY_TIMEOUT ); | |
| 68225 | -#endif | |
| 68226 | - assert( (rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT ); | |
| 68227 | - return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; | |
| 68228 | - } | |
| 68229 | - /* Now that the read-lock has been obtained, check that neither the | |
| 68230 | - ** value in the aReadMark[] array or the contents of the wal-index | |
| 68231 | - ** header have changed. | |
| 68232 | - ** | |
| 68233 | - ** It is necessary to check that the wal-index header did not change | |
| 68234 | - ** between the time it was read and when the shared-lock was obtained | |
| 68235 | - ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility | |
| 68236 | - ** that the log file may have been wrapped by a writer, or that frames | |
| 68237 | - ** that occur later in the log than pWal->hdr.mxFrame may have been | |
| 68238 | - ** copied into the database by a checkpointer. If either of these things | |
| 68239 | - ** happened, then reading the database with the current value of | |
| 68240 | - ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry | |
| 68241 | - ** instead. | |
| 68242 | - ** | |
| 68243 | - ** Before checking that the live wal-index header has not changed | |
| 68244 | - ** since it was read, set Wal.minFrame to the first frame in the wal | |
| 68245 | - ** file that has not yet been checkpointed. This client will not need | |
| 68246 | - ** to read any frames earlier than minFrame from the wal file - they | |
| 68247 | - ** can be safely read directly from the database file. | |
| 68248 | - ** | |
| 68249 | - ** Because a ShmBarrier() call is made between taking the copy of | |
| 68250 | - ** nBackfill and checking that the wal-header in shared-memory still | |
| 68251 | - ** matches the one cached in pWal->hdr, it is guaranteed that the | |
| 68252 | - ** checkpointer that set nBackfill was not working with a wal-index | |
| 68253 | - ** header newer than that cached in pWal->hdr. If it were, that could | |
| 68254 | - ** cause a problem. The checkpointer could omit to checkpoint | |
| 68255 | - ** a version of page X that lies before pWal->minFrame (call that version | |
| 68256 | - ** A) on the basis that there is a newer version (version B) of the same | |
| 68257 | - ** page later in the wal file. But if version B happens to like past | |
| 68258 | - ** frame pWal->hdr.mxFrame - then the client would incorrectly assume | |
| 68259 | - ** that it can read version A from the database file. However, since | |
| 68260 | - ** we can guarantee that the checkpointer that set nBackfill could not | |
| 68261 | - ** see any pages past pWal->hdr.mxFrame, this problem does not come up. | |
| 68262 | - */ | |
| 68263 | - pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; | |
| 68264 | - walShmBarrier(pWal); | |
| 68265 | - if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark | |
| 68266 | - || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) | |
| 68267 | - ){ | |
| 68268 | - walUnlockShared(pWal, WAL_READ_LOCK(mxI)); | |
| 68269 | - return WAL_RETRY; | |
| 68270 | - }else{ | |
| 68271 | - assert( mxReadMark<=pWal->hdr.mxFrame ); | |
| 68272 | - pWal->readLock = (i16)mxI; | |
| 68140 | + { | |
| 68141 | + u32 mxReadMark; /* Largest aReadMark[] value */ | |
| 68142 | + int mxI; /* Index of largest aReadMark[] value */ | |
| 68143 | + int i; /* Loop counter */ | |
| 68144 | + u32 mxFrame; /* Wal frame to lock to */ | |
| 68145 | + if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame | |
| 68146 | +#ifdef SQLITE_ENABLE_SNAPSHOT | |
| 68147 | + && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) | |
| 68148 | +#endif | |
| 68149 | + ){ | |
| 68150 | + /* The WAL has been completely backfilled (or it is empty). | |
| 68151 | + ** and can be safely ignored. | |
| 68152 | + */ | |
| 68153 | + rc = walLockShared(pWal, WAL_READ_LOCK(0)); | |
| 68154 | + walShmBarrier(pWal); | |
| 68155 | + if( rc==SQLITE_OK ){ | |
| 68156 | + if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr,sizeof(WalIndexHdr)) ){ | |
| 68157 | + /* It is not safe to allow the reader to continue here if frames | |
| 68158 | + ** may have been appended to the log before READ_LOCK(0) was obtained. | |
| 68159 | + ** When holding READ_LOCK(0), the reader ignores the entire log file, | |
| 68160 | + ** which implies that the database file contains a trustworthy | |
| 68161 | + ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from | |
| 68162 | + ** happening, this is usually correct. | |
| 68163 | + ** | |
| 68164 | + ** However, if frames have been appended to the log (or if the log | |
| 68165 | + ** is wrapped and written for that matter) before the READ_LOCK(0) | |
| 68166 | + ** is obtained, that is not necessarily true. A checkpointer may | |
| 68167 | + ** have started to backfill the appended frames but crashed before | |
| 68168 | + ** it finished. Leaving a corrupt image in the database file. | |
| 68169 | + */ | |
| 68170 | + walUnlockShared(pWal, WAL_READ_LOCK(0)); | |
| 68171 | + return WAL_RETRY; | |
| 68172 | + } | |
| 68173 | + pWal->readLock = 0; | |
| 68174 | + return SQLITE_OK; | |
| 68175 | + }else if( rc!=SQLITE_BUSY ){ | |
| 68176 | + return rc; | |
| 68177 | + } | |
| 68178 | + } | |
| 68179 | + | |
| 68180 | + /* If we get this far, it means that the reader will want to use | |
| 68181 | + ** the WAL to get at content from recent commits. The job now is | |
| 68182 | + ** to select one of the aReadMark[] entries that is closest to | |
| 68183 | + ** but not exceeding pWal->hdr.mxFrame and lock that entry. | |
| 68184 | + */ | |
| 68185 | + mxReadMark = 0; | |
| 68186 | + mxI = 0; | |
| 68187 | + mxFrame = pWal->hdr.mxFrame; | |
| 68188 | +#ifdef SQLITE_ENABLE_SNAPSHOT | |
| 68189 | + if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ | |
| 68190 | + mxFrame = pWal->pSnapshot->mxFrame; | |
| 68191 | + } | |
| 68192 | +#endif | |
| 68193 | + for(i=1; i<WAL_NREADER; i++){ | |
| 68194 | + u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; | |
| 68195 | + if( mxReadMark<=thisMark && thisMark<=mxFrame ){ | |
| 68196 | + assert( thisMark!=READMARK_NOT_USED ); | |
| 68197 | + mxReadMark = thisMark; | |
| 68198 | + mxI = i; | |
| 68199 | + } | |
| 68200 | + } | |
| 68201 | + if( (pWal->readOnly & WAL_SHM_RDONLY)==0 | |
| 68202 | + && (mxReadMark<mxFrame || mxI==0) | |
| 68203 | + ){ | |
| 68204 | + for(i=1; i<WAL_NREADER; i++){ | |
| 68205 | + rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); | |
| 68206 | + if( rc==SQLITE_OK ){ | |
| 68207 | + AtomicStore(pInfo->aReadMark+i,mxFrame); | |
| 68208 | + mxReadMark = mxFrame; | |
| 68209 | + mxI = i; | |
| 68210 | + walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); | |
| 68211 | + break; | |
| 68212 | + }else if( rc!=SQLITE_BUSY ){ | |
| 68213 | + return rc; | |
| 68214 | + } | |
| 68215 | + } | |
| 68216 | + } | |
| 68217 | + if( mxI==0 ){ | |
| 68218 | + assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); | |
| 68219 | + return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; | |
| 68220 | + } | |
| 68221 | + | |
| 68222 | + (void)walEnableBlockingMs(pWal, nBlockTmout); | |
| 68223 | + rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); | |
| 68224 | + walDisableBlocking(pWal); | |
| 68225 | + if( rc ){ | |
| 68226 | +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT | |
| 68227 | + if( rc==SQLITE_BUSY_TIMEOUT ){ | |
| 68228 | + *pCnt |= WAL_RETRY_BLOCKED_MASK; | |
| 68229 | + } | |
| 68230 | +#else | |
| 68231 | + assert( rc!=SQLITE_BUSY_TIMEOUT ); | |
| 68232 | +#endif | |
| 68233 | + assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT); | |
| 68234 | + return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; | |
| 68235 | + } | |
| 68236 | + /* Now that the read-lock has been obtained, check that neither the | |
| 68237 | + ** value in the aReadMark[] array or the contents of the wal-index | |
| 68238 | + ** header have changed. | |
| 68239 | + ** | |
| 68240 | + ** It is necessary to check that the wal-index header did not change | |
| 68241 | + ** between the time it was read and when the shared-lock was obtained | |
| 68242 | + ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility | |
| 68243 | + ** that the log file may have been wrapped by a writer, or that frames | |
| 68244 | + ** that occur later in the log than pWal->hdr.mxFrame may have been | |
| 68245 | + ** copied into the database by a checkpointer. If either of these things | |
| 68246 | + ** happened, then reading the database with the current value of | |
| 68247 | + ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry | |
| 68248 | + ** instead. | |
| 68249 | + ** | |
| 68250 | + ** Before checking that the live wal-index header has not changed | |
| 68251 | + ** since it was read, set Wal.minFrame to the first frame in the wal | |
| 68252 | + ** file that has not yet been checkpointed. This client will not need | |
| 68253 | + ** to read any frames earlier than minFrame from the wal file - they | |
| 68254 | + ** can be safely read directly from the database file. | |
| 68255 | + ** | |
| 68256 | + ** Because a ShmBarrier() call is made between taking the copy of | |
| 68257 | + ** nBackfill and checking that the wal-header in shared-memory still | |
| 68258 | + ** matches the one cached in pWal->hdr, it is guaranteed that the | |
| 68259 | + ** checkpointer that set nBackfill was not working with a wal-index | |
| 68260 | + ** header newer than that cached in pWal->hdr. If it were, that could | |
| 68261 | + ** cause a problem. The checkpointer could omit to checkpoint | |
| 68262 | + ** a version of page X that lies before pWal->minFrame (call that version | |
| 68263 | + ** A) on the basis that there is a newer version (version B) of the same | |
| 68264 | + ** page later in the wal file. But if version B happens to like past | |
| 68265 | + ** frame pWal->hdr.mxFrame - then the client would incorrectly assume | |
| 68266 | + ** that it can read version A from the database file. However, since | |
| 68267 | + ** we can guarantee that the checkpointer that set nBackfill could not | |
| 68268 | + ** see any pages past pWal->hdr.mxFrame, this problem does not come up. | |
| 68269 | + */ | |
| 68270 | + pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; | |
| 68271 | + walShmBarrier(pWal); | |
| 68272 | + if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark | |
| 68273 | + || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) | |
| 68274 | + ){ | |
| 68275 | + walUnlockShared(pWal, WAL_READ_LOCK(mxI)); | |
| 68276 | + return WAL_RETRY; | |
| 68277 | + }else{ | |
| 68278 | + assert( mxReadMark<=pWal->hdr.mxFrame ); | |
| 68279 | + pWal->readLock = (i16)mxI; | |
| 68280 | + } | |
| 68273 | 68281 | } |
| 68274 | 68282 | return rc; |
| 68275 | 68283 | } |
| 68276 | 68284 | |
| 68277 | 68285 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| @@ -91889,11 +91897,11 @@ | ||
| 91889 | 91897 | ** |
| 91890 | 91898 | ** sqlite3_column_int() |
| 91891 | 91899 | ** sqlite3_column_int64() |
| 91892 | 91900 | ** sqlite3_column_text() |
| 91893 | 91901 | ** sqlite3_column_text16() |
| 91894 | -** sqlite3_column_real() | |
| 91902 | +** sqlite3_column_double() | |
| 91895 | 91903 | ** sqlite3_column_bytes() |
| 91896 | 91904 | ** sqlite3_column_bytes16() |
| 91897 | 91905 | ** sqlite3_column_blob() |
| 91898 | 91906 | */ |
| 91899 | 91907 | static void columnMallocFailure(sqlite3_stmt *pStmt) |
| @@ -109896,11 +109904,11 @@ | ||
| 109896 | 109904 | p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 109897 | 109905 | } |
| 109898 | 109906 | p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); |
| 109899 | 109907 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 109900 | 109908 | (void*)p4, P4_COLLSEQ); |
| 109901 | - sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); | |
| 109909 | + sqlite3VdbeChangeP5(pParse->pVdbe, (u16)p5); | |
| 109902 | 109910 | return addr; |
| 109903 | 109911 | } |
| 109904 | 109912 | |
| 109905 | 109913 | /* |
| 109906 | 109914 | ** Return true if expression pExpr is a vector, or false otherwise. |
| @@ -129732,11 +129740,11 @@ | ||
| 129732 | 129740 | || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) |
| 129733 | 129741 | ){ |
| 129734 | 129742 | return; |
| 129735 | 129743 | } |
| 129736 | 129744 | p0type = sqlite3_value_type(argv[0]); |
| 129737 | - p1 = sqlite3_value_int(argv[1]); | |
| 129745 | + p1 = sqlite3_value_int64(argv[1]); | |
| 129738 | 129746 | if( p0type==SQLITE_BLOB ){ |
| 129739 | 129747 | len = sqlite3_value_bytes(argv[0]); |
| 129740 | 129748 | z = sqlite3_value_blob(argv[0]); |
| 129741 | 129749 | if( z==0 ) return; |
| 129742 | 129750 | assert( len==sqlite3_value_bytes(argv[0]) ); |
| @@ -129757,11 +129765,11 @@ | ||
| 129757 | 129765 | ** from 2009-02-02 for compatibility of applications that exploited the |
| 129758 | 129766 | ** old buggy behavior. */ |
| 129759 | 129767 | if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */ |
| 129760 | 129768 | #endif |
| 129761 | 129769 | if( argc==3 ){ |
| 129762 | - p2 = sqlite3_value_int(argv[2]); | |
| 129770 | + p2 = sqlite3_value_int64(argv[2]); | |
| 129763 | 129771 | if( p2<0 ){ |
| 129764 | 129772 | p2 = -p2; |
| 129765 | 129773 | negP2 = 1; |
| 129766 | 129774 | } |
| 129767 | 129775 | }else{ |
| @@ -129796,13 +129804,15 @@ | ||
| 129796 | 129804 | SQLITE_SKIP_UTF8(z2); |
| 129797 | 129805 | } |
| 129798 | 129806 | sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, |
| 129799 | 129807 | SQLITE_UTF8); |
| 129800 | 129808 | }else{ |
| 129801 | - if( p1+p2>len ){ | |
| 129809 | + if( p1>=len ){ | |
| 129810 | + p1 = p2 = 0; | |
| 129811 | + }else if( p2>len-p1 ){ | |
| 129802 | 129812 | p2 = len-p1; |
| 129803 | - if( p2<0 ) p2 = 0; | |
| 129813 | + assert( p2>0 ); | |
| 129804 | 129814 | } |
| 129805 | 129815 | sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); |
| 129806 | 129816 | } |
| 129807 | 129817 | } |
| 129808 | 129818 | |
| @@ -129809,17 +129819,17 @@ | ||
| 129809 | 129819 | /* |
| 129810 | 129820 | ** Implementation of the round() function |
| 129811 | 129821 | */ |
| 129812 | 129822 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 129813 | 129823 | static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ |
| 129814 | - int n = 0; | |
| 129824 | + i64 n = 0; | |
| 129815 | 129825 | double r; |
| 129816 | 129826 | char *zBuf; |
| 129817 | 129827 | assert( argc==1 || argc==2 ); |
| 129818 | 129828 | if( argc==2 ){ |
| 129819 | 129829 | if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; |
| 129820 | - n = sqlite3_value_int(argv[1]); | |
| 129830 | + n = sqlite3_value_int64(argv[1]); | |
| 129821 | 129831 | if( n>30 ) n = 30; |
| 129822 | 129832 | if( n<0 ) n = 0; |
| 129823 | 129833 | } |
| 129824 | 129834 | if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; |
| 129825 | 129835 | r = sqlite3_value_double(argv[0]); |
| @@ -141316,11 +141326,11 @@ | ||
| 141316 | 141326 | sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt); |
| 141317 | 141327 | sqlite3ClearTempRegCache(pParse); |
| 141318 | 141328 | |
| 141319 | 141329 | /* Do the b-tree integrity checks */ |
| 141320 | 141330 | sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); |
| 141321 | - sqlite3VdbeChangeP5(v, (u8)i); | |
| 141331 | + sqlite3VdbeChangeP5(v, (u16)i); | |
| 141322 | 141332 | addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); |
| 141323 | 141333 | sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, |
| 141324 | 141334 | sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), |
| 141325 | 141335 | P4_DYNAMIC); |
| 141326 | 141336 | sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); |
| @@ -150549,11 +150559,11 @@ | ||
| 150549 | 150559 | } |
| 150550 | 150560 | sqlite3ReleaseTempReg(pParse, regSubtype); |
| 150551 | 150561 | } |
| 150552 | 150562 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150553 | 150563 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150554 | - sqlite3VdbeChangeP5(v, (u8)nArg); | |
| 150564 | + sqlite3VdbeChangeP5(v, (u16)nArg); | |
| 150555 | 150565 | sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); |
| 150556 | 150566 | sqlite3VdbeJumpHere(v, iTop); |
| 150557 | 150567 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150558 | 150568 | } |
| 150559 | 150569 | sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), |
| @@ -150712,11 +150722,11 @@ | ||
| 150712 | 150722 | sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, |
| 150713 | 150723 | (char *)pColl, P4_COLLSEQ); |
| 150714 | 150724 | } |
| 150715 | 150725 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150716 | 150726 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150717 | - sqlite3VdbeChangeP5(v, (u8)nArg); | |
| 150727 | + sqlite3VdbeChangeP5(v, (u16)nArg); | |
| 150718 | 150728 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150719 | 150729 | } |
| 150720 | 150730 | if( addrNext ){ |
| 150721 | 150731 | sqlite3VdbeResolveLabel(v, addrNext); |
| 150722 | 150732 | } |
| @@ -154106,11 +154116,11 @@ | ||
| 154106 | 154116 | /* Set the P5 operand of the OP_Program instruction to non-zero if |
| 154107 | 154117 | ** recursive invocation of this trigger program is disallowed. Recursive |
| 154108 | 154118 | ** invocation is disallowed if (a) the sub-program is really a trigger, |
| 154109 | 154119 | ** not a foreign key action, and (b) the flag to enable recursive triggers |
| 154110 | 154120 | ** is clear. */ |
| 154111 | - sqlite3VdbeChangeP5(v, (u8)bRecursive); | |
| 154121 | + sqlite3VdbeChangeP5(v, (u16)bRecursive); | |
| 154112 | 154122 | } |
| 154113 | 154123 | } |
| 154114 | 154124 | |
| 154115 | 154125 | /* |
| 154116 | 154126 | ** This is called to code the required FOR EACH ROW triggers for an operation |
| @@ -170414,10 +170424,11 @@ | ||
| 170414 | 170424 | int pc, |
| 170415 | 170425 | VdbeOp *pOp |
| 170416 | 170426 | ){ |
| 170417 | 170427 | if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; |
| 170418 | 170428 | sqlite3VdbePrintOp(0, pc, pOp); |
| 170429 | + sqlite3ShowWhereTerm(0); /* So compiler won't complain about unused func */ | |
| 170419 | 170430 | } |
| 170420 | 170431 | #endif |
| 170421 | 170432 | |
| 170422 | 170433 | /* |
| 170423 | 170434 | ** Generate the end of the WHERE loop. See comments on |
| @@ -172523,11 +172534,11 @@ | ||
| 172523 | 172534 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); |
| 172524 | 172535 | } |
| 172525 | 172536 | sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, |
| 172526 | 172537 | bInverse, regArg, pWin->regAccum); |
| 172527 | 172538 | sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); |
| 172528 | - sqlite3VdbeChangeP5(v, (u8)nArg); | |
| 172539 | + sqlite3VdbeChangeP5(v, (u16)nArg); | |
| 172529 | 172540 | if( pWin->bExprArgs ){ |
| 172530 | 172541 | sqlite3ReleaseTempRange(pParse, regArg, nArg); |
| 172531 | 172542 | } |
| 172532 | 172543 | } |
| 172533 | 172544 | |
| @@ -184078,12 +184089,12 @@ | ||
| 184078 | 184089 | # error SQLITE_MAX_COMPOUND_SELECT must be at least 2 |
| 184079 | 184090 | #endif |
| 184080 | 184091 | #if SQLITE_MAX_VDBE_OP<40 |
| 184081 | 184092 | # error SQLITE_MAX_VDBE_OP must be at least 40 |
| 184082 | 184093 | #endif |
| 184083 | -#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127 | |
| 184084 | -# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127 | |
| 184094 | +#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>32767 | |
| 184095 | +# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 32767 | |
| 184085 | 184096 | #endif |
| 184086 | 184097 | #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>125 |
| 184087 | 184098 | # error SQLITE_MAX_ATTACHED must be between 0 and 125 |
| 184088 | 184099 | #endif |
| 184089 | 184100 | #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 |
| @@ -185492,11 +185503,10 @@ | ||
| 185492 | 185503 | #if defined(SQLITE_DEBUG) |
| 185493 | 185504 | /* Invoke these debugging routines so that the compiler does not |
| 185494 | 185505 | ** issue "defined but not used" warnings. */ |
| 185495 | 185506 | if( x==9999 ){ |
| 185496 | 185507 | sqlite3ShowExpr(0); |
| 185497 | - sqlite3ShowExpr(0); | |
| 185498 | 185508 | sqlite3ShowExprList(0); |
| 185499 | 185509 | sqlite3ShowIdList(0); |
| 185500 | 185510 | sqlite3ShowSrcList(0); |
| 185501 | 185511 | sqlite3ShowWith(0); |
| 185502 | 185512 | sqlite3ShowUpsert(0); |
| @@ -185509,11 +185519,10 @@ | ||
| 185509 | 185519 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 185510 | 185520 | sqlite3ShowWindow(0); |
| 185511 | 185521 | sqlite3ShowWinFunc(0); |
| 185512 | 185522 | #endif |
| 185513 | 185523 | sqlite3ShowSelect(0); |
| 185514 | - sqlite3ShowWhereTerm(0); | |
| 185515 | 185524 | } |
| 185516 | 185525 | #endif |
| 185517 | 185526 | break; |
| 185518 | 185527 | } |
| 185519 | 185528 | |
| @@ -226344,11 +226353,15 @@ | ||
| 226344 | 226353 | static int dbpageSync(sqlite3_vtab *pVtab){ |
| 226345 | 226354 | DbpageTable *pTab = (DbpageTable *)pVtab; |
| 226346 | 226355 | if( pTab->pgnoTrunc>0 ){ |
| 226347 | 226356 | Btree *pBt = pTab->db->aDb[pTab->iDbTrunc].pBt; |
| 226348 | 226357 | Pager *pPager = sqlite3BtreePager(pBt); |
| 226349 | - sqlite3PagerTruncateImage(pPager, pTab->pgnoTrunc); | |
| 226358 | + sqlite3BtreeEnter(pBt); | |
| 226359 | + if( pTab->pgnoTrunc<sqlite3BtreeLastPage(pBt) ){ | |
| 226360 | + sqlite3PagerTruncateImage(pPager, pTab->pgnoTrunc); | |
| 226361 | + } | |
| 226362 | + sqlite3BtreeLeave(pBt); | |
| 226350 | 226363 | } |
| 226351 | 226364 | pTab->pgnoTrunc = 0; |
| 226352 | 226365 | return SQLITE_OK; |
| 226353 | 226366 | } |
| 226354 | 226367 | |
| @@ -255419,11 +255432,11 @@ | ||
| 255419 | 255432 | int nArg, /* Number of args */ |
| 255420 | 255433 | sqlite3_value **apUnused /* Function arguments */ |
| 255421 | 255434 | ){ |
| 255422 | 255435 | assert( nArg==0 ); |
| 255423 | 255436 | UNUSED_PARAM2(nArg, apUnused); |
| 255424 | - sqlite3_result_text(pCtx, "fts5: 2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653", -1, SQLITE_TRANSIENT); | |
| 255437 | + sqlite3_result_text(pCtx, "fts5: 2024-12-19 14:20:47 5b96dcf5f6bf41dcb89ced64efd4585e36dce718c428c2324d94e4942905c3bb", -1, SQLITE_TRANSIENT); | |
| 255425 | 255438 | } |
| 255426 | 255439 | |
| 255427 | 255440 | /* |
| 255428 | 255441 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255429 | 255442 | ** |
| 255430 | 255443 |
| --- 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 | ** e2bae4143afd07de1ae55a6d2606a3b541a5 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.48.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3048000 |
| 470 | #define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -14046,13 +14046,17 @@ | |
| 14046 | # define SQLITE_MAX_VDBE_OP 250000000 |
| 14047 | #endif |
| 14048 | |
| 14049 | /* |
| 14050 | ** The maximum number of arguments to an SQL function. |
| 14051 | */ |
| 14052 | #ifndef SQLITE_MAX_FUNCTION_ARG |
| 14053 | # define SQLITE_MAX_FUNCTION_ARG 127 |
| 14054 | #endif |
| 14055 | |
| 14056 | /* |
| 14057 | ** The suggested maximum number of in-memory pages to use for |
| 14058 | ** the main database table and for temporary tables. |
| @@ -16049,10 +16053,26 @@ | |
| 16049 | #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ |
| 16050 | #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ |
| 16051 | #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ |
| 16052 | #define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ |
| 16053 | #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ |
| 16054 | |
| 16055 | /* |
| 16056 | ** Flags that make up the mask passed to sqlite3PagerGet(). |
| 16057 | */ |
| 16058 | #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ |
| @@ -18113,11 +18133,11 @@ | |
| 18113 | ** |
| 18114 | ** The u.pHash field is used by the global built-ins. The u.pDestructor |
| 18115 | ** field is used by per-connection app-def functions. |
| 18116 | */ |
| 18117 | struct FuncDef { |
| 18118 | i8 nArg; /* Number of arguments. -1 means unlimited */ |
| 18119 | u32 funcFlags; /* Some combination of SQLITE_FUNC_* */ |
| 18120 | void *pUserData; /* User data parameter */ |
| 18121 | FuncDef *pNext; /* Next function with same name */ |
| 18122 | void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */ |
| 18123 | void (*xFinalize)(sqlite3_context*); /* Agg finalizer */ |
| @@ -23708,11 +23728,11 @@ | |
| 23708 | Vdbe *pVdbe; /* The VM that owns this context */ |
| 23709 | int iOp; /* Instruction number of OP_Function */ |
| 23710 | int isError; /* Error code returned by the function. */ |
| 23711 | u8 enc; /* Encoding to use for results */ |
| 23712 | u8 skipFlag; /* Skip accumulator loading if true */ |
| 23713 | u8 argc; /* Number of arguments */ |
| 23714 | sqlite3_value *argv[1]; /* Argument set */ |
| 23715 | }; |
| 23716 | |
| 23717 | /* A bitfield type for use inside of structures. Always follow with :N where |
| 23718 | ** N is the number of bits. |
| @@ -58014,24 +58034,10 @@ | |
| 58014 | # define USEFETCH(x) ((x)->bUseFetch) |
| 58015 | #else |
| 58016 | # define USEFETCH(x) 0 |
| 58017 | #endif |
| 58018 | |
| 58019 | /* |
| 58020 | ** The argument to this macro is a file descriptor (type sqlite3_file*). |
| 58021 | ** Return 0 if it is not open, or non-zero (but not 1) if it is. |
| 58022 | ** |
| 58023 | ** This is so that expressions can be written as: |
| 58024 | ** |
| 58025 | ** if( isOpen(pPager->jfd) ){ ... |
| 58026 | ** |
| 58027 | ** instead of |
| 58028 | ** |
| 58029 | ** if( pPager->jfd->pMethods ){ ... |
| 58030 | */ |
| 58031 | #define isOpen(pFd) ((pFd)->pMethods!=0) |
| 58032 | |
| 58033 | #ifdef SQLITE_DIRECT_OVERFLOW_READ |
| 58034 | /* |
| 58035 | ** Return true if page pgno can be read directly from the database file |
| 58036 | ** by the b-tree layer. This is the case if: |
| 58037 | ** |
| @@ -59313,11 +59319,11 @@ | |
| 59313 | rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); |
| 59314 | } |
| 59315 | } |
| 59316 | pPager->journalOff = 0; |
| 59317 | }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST |
| 59318 | || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL) |
| 59319 | ){ |
| 59320 | rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile); |
| 59321 | pPager->journalOff = 0; |
| 59322 | }else{ |
| 59323 | /* This branch may be executed with Pager.journalMode==MEMORY if |
| @@ -68023,15 +68029,11 @@ | |
| 68023 | ** so it takes care to hold an exclusive lock on the corresponding |
| 68024 | ** WAL_READ_LOCK() while changing values. |
| 68025 | */ |
| 68026 | static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ |
| 68027 | volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ |
| 68028 | u32 mxReadMark; /* Largest aReadMark[] value */ |
| 68029 | int mxI; /* Index of largest aReadMark[] value */ |
| 68030 | int i; /* Loop counter */ |
| 68031 | int rc = SQLITE_OK; /* Return code */ |
| 68032 | u32 mxFrame; /* Wal frame to lock to */ |
| 68033 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68034 | int nBlockTmout = 0; |
| 68035 | #endif |
| 68036 | |
| 68037 | assert( pWal->readLock<0 ); /* Not currently locked */ |
| @@ -68133,145 +68135,151 @@ | |
| 68133 | |
| 68134 | assert( pWal->nWiData>0 ); |
| 68135 | assert( pWal->apWiData[0]!=0 ); |
| 68136 | pInfo = walCkptInfo(pWal); |
| 68137 | SEH_INJECT_FAULT; |
| 68138 | if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame |
| 68139 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| 68140 | && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) |
| 68141 | #endif |
| 68142 | ){ |
| 68143 | /* The WAL has been completely backfilled (or it is empty). |
| 68144 | ** and can be safely ignored. |
| 68145 | */ |
| 68146 | rc = walLockShared(pWal, WAL_READ_LOCK(0)); |
| 68147 | walShmBarrier(pWal); |
| 68148 | if( rc==SQLITE_OK ){ |
| 68149 | if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){ |
| 68150 | /* It is not safe to allow the reader to continue here if frames |
| 68151 | ** may have been appended to the log before READ_LOCK(0) was obtained. |
| 68152 | ** When holding READ_LOCK(0), the reader ignores the entire log file, |
| 68153 | ** which implies that the database file contains a trustworthy |
| 68154 | ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from |
| 68155 | ** happening, this is usually correct. |
| 68156 | ** |
| 68157 | ** However, if frames have been appended to the log (or if the log |
| 68158 | ** is wrapped and written for that matter) before the READ_LOCK(0) |
| 68159 | ** is obtained, that is not necessarily true. A checkpointer may |
| 68160 | ** have started to backfill the appended frames but crashed before |
| 68161 | ** it finished. Leaving a corrupt image in the database file. |
| 68162 | */ |
| 68163 | walUnlockShared(pWal, WAL_READ_LOCK(0)); |
| 68164 | return WAL_RETRY; |
| 68165 | } |
| 68166 | pWal->readLock = 0; |
| 68167 | return SQLITE_OK; |
| 68168 | }else if( rc!=SQLITE_BUSY ){ |
| 68169 | return rc; |
| 68170 | } |
| 68171 | } |
| 68172 | |
| 68173 | /* If we get this far, it means that the reader will want to use |
| 68174 | ** the WAL to get at content from recent commits. The job now is |
| 68175 | ** to select one of the aReadMark[] entries that is closest to |
| 68176 | ** but not exceeding pWal->hdr.mxFrame and lock that entry. |
| 68177 | */ |
| 68178 | mxReadMark = 0; |
| 68179 | mxI = 0; |
| 68180 | mxFrame = pWal->hdr.mxFrame; |
| 68181 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| 68182 | if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ |
| 68183 | mxFrame = pWal->pSnapshot->mxFrame; |
| 68184 | } |
| 68185 | #endif |
| 68186 | for(i=1; i<WAL_NREADER; i++){ |
| 68187 | u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; |
| 68188 | if( mxReadMark<=thisMark && thisMark<=mxFrame ){ |
| 68189 | assert( thisMark!=READMARK_NOT_USED ); |
| 68190 | mxReadMark = thisMark; |
| 68191 | mxI = i; |
| 68192 | } |
| 68193 | } |
| 68194 | if( (pWal->readOnly & WAL_SHM_RDONLY)==0 |
| 68195 | && (mxReadMark<mxFrame || mxI==0) |
| 68196 | ){ |
| 68197 | for(i=1; i<WAL_NREADER; i++){ |
| 68198 | rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68199 | if( rc==SQLITE_OK ){ |
| 68200 | AtomicStore(pInfo->aReadMark+i,mxFrame); |
| 68201 | mxReadMark = mxFrame; |
| 68202 | mxI = i; |
| 68203 | walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68204 | break; |
| 68205 | }else if( rc!=SQLITE_BUSY ){ |
| 68206 | return rc; |
| 68207 | } |
| 68208 | } |
| 68209 | } |
| 68210 | if( mxI==0 ){ |
| 68211 | assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); |
| 68212 | return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; |
| 68213 | } |
| 68214 | |
| 68215 | (void)walEnableBlockingMs(pWal, nBlockTmout); |
| 68216 | rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68217 | walDisableBlocking(pWal); |
| 68218 | if( rc ){ |
| 68219 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68220 | if( rc==SQLITE_BUSY_TIMEOUT ){ |
| 68221 | *pCnt |= WAL_RETRY_BLOCKED_MASK; |
| 68222 | } |
| 68223 | #else |
| 68224 | assert( rc!=SQLITE_BUSY_TIMEOUT ); |
| 68225 | #endif |
| 68226 | assert( (rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT ); |
| 68227 | return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; |
| 68228 | } |
| 68229 | /* Now that the read-lock has been obtained, check that neither the |
| 68230 | ** value in the aReadMark[] array or the contents of the wal-index |
| 68231 | ** header have changed. |
| 68232 | ** |
| 68233 | ** It is necessary to check that the wal-index header did not change |
| 68234 | ** between the time it was read and when the shared-lock was obtained |
| 68235 | ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility |
| 68236 | ** that the log file may have been wrapped by a writer, or that frames |
| 68237 | ** that occur later in the log than pWal->hdr.mxFrame may have been |
| 68238 | ** copied into the database by a checkpointer. If either of these things |
| 68239 | ** happened, then reading the database with the current value of |
| 68240 | ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry |
| 68241 | ** instead. |
| 68242 | ** |
| 68243 | ** Before checking that the live wal-index header has not changed |
| 68244 | ** since it was read, set Wal.minFrame to the first frame in the wal |
| 68245 | ** file that has not yet been checkpointed. This client will not need |
| 68246 | ** to read any frames earlier than minFrame from the wal file - they |
| 68247 | ** can be safely read directly from the database file. |
| 68248 | ** |
| 68249 | ** Because a ShmBarrier() call is made between taking the copy of |
| 68250 | ** nBackfill and checking that the wal-header in shared-memory still |
| 68251 | ** matches the one cached in pWal->hdr, it is guaranteed that the |
| 68252 | ** checkpointer that set nBackfill was not working with a wal-index |
| 68253 | ** header newer than that cached in pWal->hdr. If it were, that could |
| 68254 | ** cause a problem. The checkpointer could omit to checkpoint |
| 68255 | ** a version of page X that lies before pWal->minFrame (call that version |
| 68256 | ** A) on the basis that there is a newer version (version B) of the same |
| 68257 | ** page later in the wal file. But if version B happens to like past |
| 68258 | ** frame pWal->hdr.mxFrame - then the client would incorrectly assume |
| 68259 | ** that it can read version A from the database file. However, since |
| 68260 | ** we can guarantee that the checkpointer that set nBackfill could not |
| 68261 | ** see any pages past pWal->hdr.mxFrame, this problem does not come up. |
| 68262 | */ |
| 68263 | pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; |
| 68264 | walShmBarrier(pWal); |
| 68265 | if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark |
| 68266 | || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) |
| 68267 | ){ |
| 68268 | walUnlockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68269 | return WAL_RETRY; |
| 68270 | }else{ |
| 68271 | assert( mxReadMark<=pWal->hdr.mxFrame ); |
| 68272 | pWal->readLock = (i16)mxI; |
| 68273 | } |
| 68274 | return rc; |
| 68275 | } |
| 68276 | |
| 68277 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| @@ -91889,11 +91897,11 @@ | |
| 91889 | ** |
| 91890 | ** sqlite3_column_int() |
| 91891 | ** sqlite3_column_int64() |
| 91892 | ** sqlite3_column_text() |
| 91893 | ** sqlite3_column_text16() |
| 91894 | ** sqlite3_column_real() |
| 91895 | ** sqlite3_column_bytes() |
| 91896 | ** sqlite3_column_bytes16() |
| 91897 | ** sqlite3_column_blob() |
| 91898 | */ |
| 91899 | static void columnMallocFailure(sqlite3_stmt *pStmt) |
| @@ -109896,11 +109904,11 @@ | |
| 109896 | p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 109897 | } |
| 109898 | p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); |
| 109899 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 109900 | (void*)p4, P4_COLLSEQ); |
| 109901 | sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); |
| 109902 | return addr; |
| 109903 | } |
| 109904 | |
| 109905 | /* |
| 109906 | ** Return true if expression pExpr is a vector, or false otherwise. |
| @@ -129732,11 +129740,11 @@ | |
| 129732 | || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) |
| 129733 | ){ |
| 129734 | return; |
| 129735 | } |
| 129736 | p0type = sqlite3_value_type(argv[0]); |
| 129737 | p1 = sqlite3_value_int(argv[1]); |
| 129738 | if( p0type==SQLITE_BLOB ){ |
| 129739 | len = sqlite3_value_bytes(argv[0]); |
| 129740 | z = sqlite3_value_blob(argv[0]); |
| 129741 | if( z==0 ) return; |
| 129742 | assert( len==sqlite3_value_bytes(argv[0]) ); |
| @@ -129757,11 +129765,11 @@ | |
| 129757 | ** from 2009-02-02 for compatibility of applications that exploited the |
| 129758 | ** old buggy behavior. */ |
| 129759 | if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */ |
| 129760 | #endif |
| 129761 | if( argc==3 ){ |
| 129762 | p2 = sqlite3_value_int(argv[2]); |
| 129763 | if( p2<0 ){ |
| 129764 | p2 = -p2; |
| 129765 | negP2 = 1; |
| 129766 | } |
| 129767 | }else{ |
| @@ -129796,13 +129804,15 @@ | |
| 129796 | SQLITE_SKIP_UTF8(z2); |
| 129797 | } |
| 129798 | sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, |
| 129799 | SQLITE_UTF8); |
| 129800 | }else{ |
| 129801 | if( p1+p2>len ){ |
| 129802 | p2 = len-p1; |
| 129803 | if( p2<0 ) p2 = 0; |
| 129804 | } |
| 129805 | sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); |
| 129806 | } |
| 129807 | } |
| 129808 | |
| @@ -129809,17 +129819,17 @@ | |
| 129809 | /* |
| 129810 | ** Implementation of the round() function |
| 129811 | */ |
| 129812 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 129813 | static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ |
| 129814 | int n = 0; |
| 129815 | double r; |
| 129816 | char *zBuf; |
| 129817 | assert( argc==1 || argc==2 ); |
| 129818 | if( argc==2 ){ |
| 129819 | if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; |
| 129820 | n = sqlite3_value_int(argv[1]); |
| 129821 | if( n>30 ) n = 30; |
| 129822 | if( n<0 ) n = 0; |
| 129823 | } |
| 129824 | if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; |
| 129825 | r = sqlite3_value_double(argv[0]); |
| @@ -141316,11 +141326,11 @@ | |
| 141316 | sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt); |
| 141317 | sqlite3ClearTempRegCache(pParse); |
| 141318 | |
| 141319 | /* Do the b-tree integrity checks */ |
| 141320 | sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); |
| 141321 | sqlite3VdbeChangeP5(v, (u8)i); |
| 141322 | addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); |
| 141323 | sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, |
| 141324 | sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), |
| 141325 | P4_DYNAMIC); |
| 141326 | sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); |
| @@ -150549,11 +150559,11 @@ | |
| 150549 | } |
| 150550 | sqlite3ReleaseTempReg(pParse, regSubtype); |
| 150551 | } |
| 150552 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150553 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150554 | sqlite3VdbeChangeP5(v, (u8)nArg); |
| 150555 | sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); |
| 150556 | sqlite3VdbeJumpHere(v, iTop); |
| 150557 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150558 | } |
| 150559 | sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), |
| @@ -150712,11 +150722,11 @@ | |
| 150712 | sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, |
| 150713 | (char *)pColl, P4_COLLSEQ); |
| 150714 | } |
| 150715 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150716 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150717 | sqlite3VdbeChangeP5(v, (u8)nArg); |
| 150718 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150719 | } |
| 150720 | if( addrNext ){ |
| 150721 | sqlite3VdbeResolveLabel(v, addrNext); |
| 150722 | } |
| @@ -154106,11 +154116,11 @@ | |
| 154106 | /* Set the P5 operand of the OP_Program instruction to non-zero if |
| 154107 | ** recursive invocation of this trigger program is disallowed. Recursive |
| 154108 | ** invocation is disallowed if (a) the sub-program is really a trigger, |
| 154109 | ** not a foreign key action, and (b) the flag to enable recursive triggers |
| 154110 | ** is clear. */ |
| 154111 | sqlite3VdbeChangeP5(v, (u8)bRecursive); |
| 154112 | } |
| 154113 | } |
| 154114 | |
| 154115 | /* |
| 154116 | ** This is called to code the required FOR EACH ROW triggers for an operation |
| @@ -170414,10 +170424,11 @@ | |
| 170414 | int pc, |
| 170415 | VdbeOp *pOp |
| 170416 | ){ |
| 170417 | if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; |
| 170418 | sqlite3VdbePrintOp(0, pc, pOp); |
| 170419 | } |
| 170420 | #endif |
| 170421 | |
| 170422 | /* |
| 170423 | ** Generate the end of the WHERE loop. See comments on |
| @@ -172523,11 +172534,11 @@ | |
| 172523 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); |
| 172524 | } |
| 172525 | sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, |
| 172526 | bInverse, regArg, pWin->regAccum); |
| 172527 | sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); |
| 172528 | sqlite3VdbeChangeP5(v, (u8)nArg); |
| 172529 | if( pWin->bExprArgs ){ |
| 172530 | sqlite3ReleaseTempRange(pParse, regArg, nArg); |
| 172531 | } |
| 172532 | } |
| 172533 | |
| @@ -184078,12 +184089,12 @@ | |
| 184078 | # error SQLITE_MAX_COMPOUND_SELECT must be at least 2 |
| 184079 | #endif |
| 184080 | #if SQLITE_MAX_VDBE_OP<40 |
| 184081 | # error SQLITE_MAX_VDBE_OP must be at least 40 |
| 184082 | #endif |
| 184083 | #if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127 |
| 184084 | # error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127 |
| 184085 | #endif |
| 184086 | #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>125 |
| 184087 | # error SQLITE_MAX_ATTACHED must be between 0 and 125 |
| 184088 | #endif |
| 184089 | #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 |
| @@ -185492,11 +185503,10 @@ | |
| 185492 | #if defined(SQLITE_DEBUG) |
| 185493 | /* Invoke these debugging routines so that the compiler does not |
| 185494 | ** issue "defined but not used" warnings. */ |
| 185495 | if( x==9999 ){ |
| 185496 | sqlite3ShowExpr(0); |
| 185497 | sqlite3ShowExpr(0); |
| 185498 | sqlite3ShowExprList(0); |
| 185499 | sqlite3ShowIdList(0); |
| 185500 | sqlite3ShowSrcList(0); |
| 185501 | sqlite3ShowWith(0); |
| 185502 | sqlite3ShowUpsert(0); |
| @@ -185509,11 +185519,10 @@ | |
| 185509 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 185510 | sqlite3ShowWindow(0); |
| 185511 | sqlite3ShowWinFunc(0); |
| 185512 | #endif |
| 185513 | sqlite3ShowSelect(0); |
| 185514 | sqlite3ShowWhereTerm(0); |
| 185515 | } |
| 185516 | #endif |
| 185517 | break; |
| 185518 | } |
| 185519 | |
| @@ -226344,11 +226353,15 @@ | |
| 226344 | static int dbpageSync(sqlite3_vtab *pVtab){ |
| 226345 | DbpageTable *pTab = (DbpageTable *)pVtab; |
| 226346 | if( pTab->pgnoTrunc>0 ){ |
| 226347 | Btree *pBt = pTab->db->aDb[pTab->iDbTrunc].pBt; |
| 226348 | Pager *pPager = sqlite3BtreePager(pBt); |
| 226349 | sqlite3PagerTruncateImage(pPager, pTab->pgnoTrunc); |
| 226350 | } |
| 226351 | pTab->pgnoTrunc = 0; |
| 226352 | return SQLITE_OK; |
| 226353 | } |
| 226354 | |
| @@ -255419,11 +255432,11 @@ | |
| 255419 | int nArg, /* Number of args */ |
| 255420 | sqlite3_value **apUnused /* Function arguments */ |
| 255421 | ){ |
| 255422 | assert( nArg==0 ); |
| 255423 | UNUSED_PARAM2(nArg, apUnused); |
| 255424 | sqlite3_result_text(pCtx, "fts5: 2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653", -1, SQLITE_TRANSIENT); |
| 255425 | } |
| 255426 | |
| 255427 | /* |
| 255428 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255429 | ** |
| 255430 |
| --- 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 | ** e6c30ee52c5cdc193804cec63374d558b45e 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.48.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3048000 |
| 470 | #define SQLITE_SOURCE_ID "2024-12-19 19:02:09 e6c30ee52c5cdc193804cec63374d558b45e4d67fc6bde58771ca78485ca0acf" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -14046,13 +14046,17 @@ | |
| 14046 | # define SQLITE_MAX_VDBE_OP 250000000 |
| 14047 | #endif |
| 14048 | |
| 14049 | /* |
| 14050 | ** The maximum number of arguments to an SQL function. |
| 14051 | ** |
| 14052 | ** This value has a hard upper limit of 32767 due to storage |
| 14053 | ** constraints (it needs to fit inside a i16). We keep it |
| 14054 | ** lower than that to prevent abuse. |
| 14055 | */ |
| 14056 | #ifndef SQLITE_MAX_FUNCTION_ARG |
| 14057 | # define SQLITE_MAX_FUNCTION_ARG 1000 |
| 14058 | #endif |
| 14059 | |
| 14060 | /* |
| 14061 | ** The suggested maximum number of in-memory pages to use for |
| 14062 | ** the main database table and for temporary tables. |
| @@ -16049,10 +16053,26 @@ | |
| 16053 | #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ |
| 16054 | #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ |
| 16055 | #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ |
| 16056 | #define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ |
| 16057 | #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ |
| 16058 | |
| 16059 | #define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL) |
| 16060 | |
| 16061 | /* |
| 16062 | ** The argument to this macro is a file descriptor (type sqlite3_file*). |
| 16063 | ** Return 0 if it is not open, or non-zero (but not 1) if it is. |
| 16064 | ** |
| 16065 | ** This is so that expressions can be written as: |
| 16066 | ** |
| 16067 | ** if( isOpen(pPager->jfd) ){ ... |
| 16068 | ** |
| 16069 | ** instead of |
| 16070 | ** |
| 16071 | ** if( pPager->jfd->pMethods ){ ... |
| 16072 | */ |
| 16073 | #define isOpen(pFd) ((pFd)->pMethods!=0) |
| 16074 | |
| 16075 | /* |
| 16076 | ** Flags that make up the mask passed to sqlite3PagerGet(). |
| 16077 | */ |
| 16078 | #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ |
| @@ -18113,11 +18133,11 @@ | |
| 18133 | ** |
| 18134 | ** The u.pHash field is used by the global built-ins. The u.pDestructor |
| 18135 | ** field is used by per-connection app-def functions. |
| 18136 | */ |
| 18137 | struct FuncDef { |
| 18138 | i16 nArg; /* Number of arguments. -1 means unlimited */ |
| 18139 | u32 funcFlags; /* Some combination of SQLITE_FUNC_* */ |
| 18140 | void *pUserData; /* User data parameter */ |
| 18141 | FuncDef *pNext; /* Next function with same name */ |
| 18142 | void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */ |
| 18143 | void (*xFinalize)(sqlite3_context*); /* Agg finalizer */ |
| @@ -23708,11 +23728,11 @@ | |
| 23728 | Vdbe *pVdbe; /* The VM that owns this context */ |
| 23729 | int iOp; /* Instruction number of OP_Function */ |
| 23730 | int isError; /* Error code returned by the function. */ |
| 23731 | u8 enc; /* Encoding to use for results */ |
| 23732 | u8 skipFlag; /* Skip accumulator loading if true */ |
| 23733 | u16 argc; /* Number of arguments */ |
| 23734 | sqlite3_value *argv[1]; /* Argument set */ |
| 23735 | }; |
| 23736 | |
| 23737 | /* A bitfield type for use inside of structures. Always follow with :N where |
| 23738 | ** N is the number of bits. |
| @@ -58014,24 +58034,10 @@ | |
| 58034 | # define USEFETCH(x) ((x)->bUseFetch) |
| 58035 | #else |
| 58036 | # define USEFETCH(x) 0 |
| 58037 | #endif |
| 58038 | |
| 58039 | #ifdef SQLITE_DIRECT_OVERFLOW_READ |
| 58040 | /* |
| 58041 | ** Return true if page pgno can be read directly from the database file |
| 58042 | ** by the b-tree layer. This is the case if: |
| 58043 | ** |
| @@ -59313,11 +59319,11 @@ | |
| 59319 | rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); |
| 59320 | } |
| 59321 | } |
| 59322 | pPager->journalOff = 0; |
| 59323 | }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST |
| 59324 | || (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL) |
| 59325 | ){ |
| 59326 | rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile); |
| 59327 | pPager->journalOff = 0; |
| 59328 | }else{ |
| 59329 | /* This branch may be executed with Pager.journalMode==MEMORY if |
| @@ -68023,15 +68029,11 @@ | |
| 68029 | ** so it takes care to hold an exclusive lock on the corresponding |
| 68030 | ** WAL_READ_LOCK() while changing values. |
| 68031 | */ |
| 68032 | static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ |
| 68033 | volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ |
| 68034 | int rc = SQLITE_OK; /* Return code */ |
| 68035 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68036 | int nBlockTmout = 0; |
| 68037 | #endif |
| 68038 | |
| 68039 | assert( pWal->readLock<0 ); /* Not currently locked */ |
| @@ -68133,145 +68135,151 @@ | |
| 68135 | |
| 68136 | assert( pWal->nWiData>0 ); |
| 68137 | assert( pWal->apWiData[0]!=0 ); |
| 68138 | pInfo = walCkptInfo(pWal); |
| 68139 | SEH_INJECT_FAULT; |
| 68140 | { |
| 68141 | u32 mxReadMark; /* Largest aReadMark[] value */ |
| 68142 | int mxI; /* Index of largest aReadMark[] value */ |
| 68143 | int i; /* Loop counter */ |
| 68144 | u32 mxFrame; /* Wal frame to lock to */ |
| 68145 | if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame |
| 68146 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| 68147 | && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) |
| 68148 | #endif |
| 68149 | ){ |
| 68150 | /* The WAL has been completely backfilled (or it is empty). |
| 68151 | ** and can be safely ignored. |
| 68152 | */ |
| 68153 | rc = walLockShared(pWal, WAL_READ_LOCK(0)); |
| 68154 | walShmBarrier(pWal); |
| 68155 | if( rc==SQLITE_OK ){ |
| 68156 | if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr,sizeof(WalIndexHdr)) ){ |
| 68157 | /* It is not safe to allow the reader to continue here if frames |
| 68158 | ** may have been appended to the log before READ_LOCK(0) was obtained. |
| 68159 | ** When holding READ_LOCK(0), the reader ignores the entire log file, |
| 68160 | ** which implies that the database file contains a trustworthy |
| 68161 | ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from |
| 68162 | ** happening, this is usually correct. |
| 68163 | ** |
| 68164 | ** However, if frames have been appended to the log (or if the log |
| 68165 | ** is wrapped and written for that matter) before the READ_LOCK(0) |
| 68166 | ** is obtained, that is not necessarily true. A checkpointer may |
| 68167 | ** have started to backfill the appended frames but crashed before |
| 68168 | ** it finished. Leaving a corrupt image in the database file. |
| 68169 | */ |
| 68170 | walUnlockShared(pWal, WAL_READ_LOCK(0)); |
| 68171 | return WAL_RETRY; |
| 68172 | } |
| 68173 | pWal->readLock = 0; |
| 68174 | return SQLITE_OK; |
| 68175 | }else if( rc!=SQLITE_BUSY ){ |
| 68176 | return rc; |
| 68177 | } |
| 68178 | } |
| 68179 | |
| 68180 | /* If we get this far, it means that the reader will want to use |
| 68181 | ** the WAL to get at content from recent commits. The job now is |
| 68182 | ** to select one of the aReadMark[] entries that is closest to |
| 68183 | ** but not exceeding pWal->hdr.mxFrame and lock that entry. |
| 68184 | */ |
| 68185 | mxReadMark = 0; |
| 68186 | mxI = 0; |
| 68187 | mxFrame = pWal->hdr.mxFrame; |
| 68188 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| 68189 | if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ |
| 68190 | mxFrame = pWal->pSnapshot->mxFrame; |
| 68191 | } |
| 68192 | #endif |
| 68193 | for(i=1; i<WAL_NREADER; i++){ |
| 68194 | u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; |
| 68195 | if( mxReadMark<=thisMark && thisMark<=mxFrame ){ |
| 68196 | assert( thisMark!=READMARK_NOT_USED ); |
| 68197 | mxReadMark = thisMark; |
| 68198 | mxI = i; |
| 68199 | } |
| 68200 | } |
| 68201 | if( (pWal->readOnly & WAL_SHM_RDONLY)==0 |
| 68202 | && (mxReadMark<mxFrame || mxI==0) |
| 68203 | ){ |
| 68204 | for(i=1; i<WAL_NREADER; i++){ |
| 68205 | rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68206 | if( rc==SQLITE_OK ){ |
| 68207 | AtomicStore(pInfo->aReadMark+i,mxFrame); |
| 68208 | mxReadMark = mxFrame; |
| 68209 | mxI = i; |
| 68210 | walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68211 | break; |
| 68212 | }else if( rc!=SQLITE_BUSY ){ |
| 68213 | return rc; |
| 68214 | } |
| 68215 | } |
| 68216 | } |
| 68217 | if( mxI==0 ){ |
| 68218 | assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); |
| 68219 | return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; |
| 68220 | } |
| 68221 | |
| 68222 | (void)walEnableBlockingMs(pWal, nBlockTmout); |
| 68223 | rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68224 | walDisableBlocking(pWal); |
| 68225 | if( rc ){ |
| 68226 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68227 | if( rc==SQLITE_BUSY_TIMEOUT ){ |
| 68228 | *pCnt |= WAL_RETRY_BLOCKED_MASK; |
| 68229 | } |
| 68230 | #else |
| 68231 | assert( rc!=SQLITE_BUSY_TIMEOUT ); |
| 68232 | #endif |
| 68233 | assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT); |
| 68234 | return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; |
| 68235 | } |
| 68236 | /* Now that the read-lock has been obtained, check that neither the |
| 68237 | ** value in the aReadMark[] array or the contents of the wal-index |
| 68238 | ** header have changed. |
| 68239 | ** |
| 68240 | ** It is necessary to check that the wal-index header did not change |
| 68241 | ** between the time it was read and when the shared-lock was obtained |
| 68242 | ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility |
| 68243 | ** that the log file may have been wrapped by a writer, or that frames |
| 68244 | ** that occur later in the log than pWal->hdr.mxFrame may have been |
| 68245 | ** copied into the database by a checkpointer. If either of these things |
| 68246 | ** happened, then reading the database with the current value of |
| 68247 | ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry |
| 68248 | ** instead. |
| 68249 | ** |
| 68250 | ** Before checking that the live wal-index header has not changed |
| 68251 | ** since it was read, set Wal.minFrame to the first frame in the wal |
| 68252 | ** file that has not yet been checkpointed. This client will not need |
| 68253 | ** to read any frames earlier than minFrame from the wal file - they |
| 68254 | ** can be safely read directly from the database file. |
| 68255 | ** |
| 68256 | ** Because a ShmBarrier() call is made between taking the copy of |
| 68257 | ** nBackfill and checking that the wal-header in shared-memory still |
| 68258 | ** matches the one cached in pWal->hdr, it is guaranteed that the |
| 68259 | ** checkpointer that set nBackfill was not working with a wal-index |
| 68260 | ** header newer than that cached in pWal->hdr. If it were, that could |
| 68261 | ** cause a problem. The checkpointer could omit to checkpoint |
| 68262 | ** a version of page X that lies before pWal->minFrame (call that version |
| 68263 | ** A) on the basis that there is a newer version (version B) of the same |
| 68264 | ** page later in the wal file. But if version B happens to like past |
| 68265 | ** frame pWal->hdr.mxFrame - then the client would incorrectly assume |
| 68266 | ** that it can read version A from the database file. However, since |
| 68267 | ** we can guarantee that the checkpointer that set nBackfill could not |
| 68268 | ** see any pages past pWal->hdr.mxFrame, this problem does not come up. |
| 68269 | */ |
| 68270 | pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; |
| 68271 | walShmBarrier(pWal); |
| 68272 | if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark |
| 68273 | || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) |
| 68274 | ){ |
| 68275 | walUnlockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68276 | return WAL_RETRY; |
| 68277 | }else{ |
| 68278 | assert( mxReadMark<=pWal->hdr.mxFrame ); |
| 68279 | pWal->readLock = (i16)mxI; |
| 68280 | } |
| 68281 | } |
| 68282 | return rc; |
| 68283 | } |
| 68284 | |
| 68285 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| @@ -91889,11 +91897,11 @@ | |
| 91897 | ** |
| 91898 | ** sqlite3_column_int() |
| 91899 | ** sqlite3_column_int64() |
| 91900 | ** sqlite3_column_text() |
| 91901 | ** sqlite3_column_text16() |
| 91902 | ** sqlite3_column_double() |
| 91903 | ** sqlite3_column_bytes() |
| 91904 | ** sqlite3_column_bytes16() |
| 91905 | ** sqlite3_column_blob() |
| 91906 | */ |
| 91907 | static void columnMallocFailure(sqlite3_stmt *pStmt) |
| @@ -109896,11 +109904,11 @@ | |
| 109904 | p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 109905 | } |
| 109906 | p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); |
| 109907 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 109908 | (void*)p4, P4_COLLSEQ); |
| 109909 | sqlite3VdbeChangeP5(pParse->pVdbe, (u16)p5); |
| 109910 | return addr; |
| 109911 | } |
| 109912 | |
| 109913 | /* |
| 109914 | ** Return true if expression pExpr is a vector, or false otherwise. |
| @@ -129732,11 +129740,11 @@ | |
| 129740 | || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) |
| 129741 | ){ |
| 129742 | return; |
| 129743 | } |
| 129744 | p0type = sqlite3_value_type(argv[0]); |
| 129745 | p1 = sqlite3_value_int64(argv[1]); |
| 129746 | if( p0type==SQLITE_BLOB ){ |
| 129747 | len = sqlite3_value_bytes(argv[0]); |
| 129748 | z = sqlite3_value_blob(argv[0]); |
| 129749 | if( z==0 ) return; |
| 129750 | assert( len==sqlite3_value_bytes(argv[0]) ); |
| @@ -129757,11 +129765,11 @@ | |
| 129765 | ** from 2009-02-02 for compatibility of applications that exploited the |
| 129766 | ** old buggy behavior. */ |
| 129767 | if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */ |
| 129768 | #endif |
| 129769 | if( argc==3 ){ |
| 129770 | p2 = sqlite3_value_int64(argv[2]); |
| 129771 | if( p2<0 ){ |
| 129772 | p2 = -p2; |
| 129773 | negP2 = 1; |
| 129774 | } |
| 129775 | }else{ |
| @@ -129796,13 +129804,15 @@ | |
| 129804 | SQLITE_SKIP_UTF8(z2); |
| 129805 | } |
| 129806 | sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, |
| 129807 | SQLITE_UTF8); |
| 129808 | }else{ |
| 129809 | if( p1>=len ){ |
| 129810 | p1 = p2 = 0; |
| 129811 | }else if( p2>len-p1 ){ |
| 129812 | p2 = len-p1; |
| 129813 | assert( p2>0 ); |
| 129814 | } |
| 129815 | sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); |
| 129816 | } |
| 129817 | } |
| 129818 | |
| @@ -129809,17 +129819,17 @@ | |
| 129819 | /* |
| 129820 | ** Implementation of the round() function |
| 129821 | */ |
| 129822 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 129823 | static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ |
| 129824 | i64 n = 0; |
| 129825 | double r; |
| 129826 | char *zBuf; |
| 129827 | assert( argc==1 || argc==2 ); |
| 129828 | if( argc==2 ){ |
| 129829 | if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; |
| 129830 | n = sqlite3_value_int64(argv[1]); |
| 129831 | if( n>30 ) n = 30; |
| 129832 | if( n<0 ) n = 0; |
| 129833 | } |
| 129834 | if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; |
| 129835 | r = sqlite3_value_double(argv[0]); |
| @@ -141316,11 +141326,11 @@ | |
| 141326 | sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt); |
| 141327 | sqlite3ClearTempRegCache(pParse); |
| 141328 | |
| 141329 | /* Do the b-tree integrity checks */ |
| 141330 | sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); |
| 141331 | sqlite3VdbeChangeP5(v, (u16)i); |
| 141332 | addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); |
| 141333 | sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, |
| 141334 | sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), |
| 141335 | P4_DYNAMIC); |
| 141336 | sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); |
| @@ -150549,11 +150559,11 @@ | |
| 150559 | } |
| 150560 | sqlite3ReleaseTempReg(pParse, regSubtype); |
| 150561 | } |
| 150562 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150563 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150564 | sqlite3VdbeChangeP5(v, (u16)nArg); |
| 150565 | sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); |
| 150566 | sqlite3VdbeJumpHere(v, iTop); |
| 150567 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150568 | } |
| 150569 | sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), |
| @@ -150712,11 +150722,11 @@ | |
| 150722 | sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, |
| 150723 | (char *)pColl, P4_COLLSEQ); |
| 150724 | } |
| 150725 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150726 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150727 | sqlite3VdbeChangeP5(v, (u16)nArg); |
| 150728 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150729 | } |
| 150730 | if( addrNext ){ |
| 150731 | sqlite3VdbeResolveLabel(v, addrNext); |
| 150732 | } |
| @@ -154106,11 +154116,11 @@ | |
| 154116 | /* Set the P5 operand of the OP_Program instruction to non-zero if |
| 154117 | ** recursive invocation of this trigger program is disallowed. Recursive |
| 154118 | ** invocation is disallowed if (a) the sub-program is really a trigger, |
| 154119 | ** not a foreign key action, and (b) the flag to enable recursive triggers |
| 154120 | ** is clear. */ |
| 154121 | sqlite3VdbeChangeP5(v, (u16)bRecursive); |
| 154122 | } |
| 154123 | } |
| 154124 | |
| 154125 | /* |
| 154126 | ** This is called to code the required FOR EACH ROW triggers for an operation |
| @@ -170414,10 +170424,11 @@ | |
| 170424 | int pc, |
| 170425 | VdbeOp *pOp |
| 170426 | ){ |
| 170427 | if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; |
| 170428 | sqlite3VdbePrintOp(0, pc, pOp); |
| 170429 | sqlite3ShowWhereTerm(0); /* So compiler won't complain about unused func */ |
| 170430 | } |
| 170431 | #endif |
| 170432 | |
| 170433 | /* |
| 170434 | ** Generate the end of the WHERE loop. See comments on |
| @@ -172523,11 +172534,11 @@ | |
| 172534 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); |
| 172535 | } |
| 172536 | sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, |
| 172537 | bInverse, regArg, pWin->regAccum); |
| 172538 | sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); |
| 172539 | sqlite3VdbeChangeP5(v, (u16)nArg); |
| 172540 | if( pWin->bExprArgs ){ |
| 172541 | sqlite3ReleaseTempRange(pParse, regArg, nArg); |
| 172542 | } |
| 172543 | } |
| 172544 | |
| @@ -184078,12 +184089,12 @@ | |
| 184089 | # error SQLITE_MAX_COMPOUND_SELECT must be at least 2 |
| 184090 | #endif |
| 184091 | #if SQLITE_MAX_VDBE_OP<40 |
| 184092 | # error SQLITE_MAX_VDBE_OP must be at least 40 |
| 184093 | #endif |
| 184094 | #if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>32767 |
| 184095 | # error SQLITE_MAX_FUNCTION_ARG must be between 0 and 32767 |
| 184096 | #endif |
| 184097 | #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>125 |
| 184098 | # error SQLITE_MAX_ATTACHED must be between 0 and 125 |
| 184099 | #endif |
| 184100 | #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 |
| @@ -185492,11 +185503,10 @@ | |
| 185503 | #if defined(SQLITE_DEBUG) |
| 185504 | /* Invoke these debugging routines so that the compiler does not |
| 185505 | ** issue "defined but not used" warnings. */ |
| 185506 | if( x==9999 ){ |
| 185507 | sqlite3ShowExpr(0); |
| 185508 | sqlite3ShowExprList(0); |
| 185509 | sqlite3ShowIdList(0); |
| 185510 | sqlite3ShowSrcList(0); |
| 185511 | sqlite3ShowWith(0); |
| 185512 | sqlite3ShowUpsert(0); |
| @@ -185509,11 +185519,10 @@ | |
| 185519 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 185520 | sqlite3ShowWindow(0); |
| 185521 | sqlite3ShowWinFunc(0); |
| 185522 | #endif |
| 185523 | sqlite3ShowSelect(0); |
| 185524 | } |
| 185525 | #endif |
| 185526 | break; |
| 185527 | } |
| 185528 | |
| @@ -226344,11 +226353,15 @@ | |
| 226353 | static int dbpageSync(sqlite3_vtab *pVtab){ |
| 226354 | DbpageTable *pTab = (DbpageTable *)pVtab; |
| 226355 | if( pTab->pgnoTrunc>0 ){ |
| 226356 | Btree *pBt = pTab->db->aDb[pTab->iDbTrunc].pBt; |
| 226357 | Pager *pPager = sqlite3BtreePager(pBt); |
| 226358 | sqlite3BtreeEnter(pBt); |
| 226359 | if( pTab->pgnoTrunc<sqlite3BtreeLastPage(pBt) ){ |
| 226360 | sqlite3PagerTruncateImage(pPager, pTab->pgnoTrunc); |
| 226361 | } |
| 226362 | sqlite3BtreeLeave(pBt); |
| 226363 | } |
| 226364 | pTab->pgnoTrunc = 0; |
| 226365 | return SQLITE_OK; |
| 226366 | } |
| 226367 | |
| @@ -255419,11 +255432,11 @@ | |
| 255432 | int nArg, /* Number of args */ |
| 255433 | sqlite3_value **apUnused /* Function arguments */ |
| 255434 | ){ |
| 255435 | assert( nArg==0 ); |
| 255436 | UNUSED_PARAM2(nArg, apUnused); |
| 255437 | sqlite3_result_text(pCtx, "fts5: 2024-12-19 14:20:47 5b96dcf5f6bf41dcb89ced64efd4585e36dce718c428c2324d94e4942905c3bb", -1, SQLITE_TRANSIENT); |
| 255438 | } |
| 255439 | |
| 255440 | /* |
| 255441 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 255442 | ** |
| 255443 |
+1
-1
| --- 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.48.0" |
| 150 | 150 | #define SQLITE_VERSION_NUMBER 3048000 |
| 151 | -#define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653" | |
| 151 | +#define SQLITE_SOURCE_ID "2024-12-19 19:02:09 e6c30ee52c5cdc193804cec63374d558b45e4d67fc6bde58771ca78485ca0acf" | |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | 156 | ** |
| 157 | 157 |
| --- 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.48.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3048000 |
| 151 | #define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| 157 |
| --- 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.48.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3048000 |
| 151 | #define SQLITE_SOURCE_ID "2024-12-19 19:02:09 e6c30ee52c5cdc193804cec63374d558b45e4d67fc6bde58771ca78485ca0acf" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| 157 |