summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/sqlite3.c126
-rw-r--r--c/sqlite3.h6
2 files changed, 100 insertions, 32 deletions
diff --git a/c/sqlite3.c b/c/sqlite3.c
index b8f98c7..451ca8e 100644
--- a/c/sqlite3.c
+++ b/c/sqlite3.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2** This file is an amalgamation of many separate C source files from SQLite 2** This file is an amalgamation of many separate C source files from SQLite
3** version 3.39.2. By combining all the individual C code files into this 3** version 3.39.3. By combining all the individual C code files into this
4** single large file, the entire code can be compiled as a single translation 4** single large file, the entire code can be compiled as a single translation
5** unit. This allows many compilers to do optimizations that would not be 5** unit. This allows many compilers to do optimizations that would not be
6** possible if the files were compiled separately. Performance improvements 6** possible if the files were compiled separately. Performance improvements
@@ -452,9 +452,9 @@ extern "C" {
452** [sqlite3_libversion_number()], [sqlite3_sourceid()], 452** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453** [sqlite_version()] and [sqlite_source_id()]. 453** [sqlite_version()] and [sqlite_source_id()].
454*/ 454*/
455#define SQLITE_VERSION "3.39.2" 455#define SQLITE_VERSION "3.39.3"
456#define SQLITE_VERSION_NUMBER 3039002 456#define SQLITE_VERSION_NUMBER 3039003
457#define SQLITE_SOURCE_ID "2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603" 457#define SQLITE_SOURCE_ID "2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8"
458 458
459/* 459/*
460** CAPI3REF: Run-Time Library Version Numbers 460** CAPI3REF: Run-Time Library Version Numbers
@@ -13145,6 +13145,11 @@ struct fts5_api {
13145/************** Continuing where we left off in sqliteInt.h ******************/ 13145/************** Continuing where we left off in sqliteInt.h ******************/
13146 13146
13147/* 13147/*
13148** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
13149*/
13150#define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
13151
13152/*
13148** Include the configuration header output by 'configure' if we're using the 13153** Include the configuration header output by 'configure' if we're using the
13149** autoconf-based build 13154** autoconf-based build
13150*/ 13155*/
@@ -29563,8 +29568,13 @@ SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){
29563 } 29568 }
29564 DisableLookaside; 29569 DisableLookaside;
29565 if( db->pParse ){ 29570 if( db->pParse ){
29571 Parse *pParse;
29566 sqlite3ErrorMsg(db->pParse, "out of memory"); 29572 sqlite3ErrorMsg(db->pParse, "out of memory");
29567 db->pParse->rc = SQLITE_NOMEM_BKPT; 29573 db->pParse->rc = SQLITE_NOMEM_BKPT;
29574 for(pParse=db->pParse->pOuterParse; pParse; pParse = pParse->pOuterParse){
29575 pParse->nErr++;
29576 pParse->rc = SQLITE_NOMEM;
29577 }
29568 } 29578 }
29569 } 29579 }
29570 return 0; 29580 return 0;
@@ -33459,7 +33469,7 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
33459 va_list ap; 33469 va_list ap;
33460 sqlite3 *db = pParse->db; 33470 sqlite3 *db = pParse->db;
33461 assert( db!=0 ); 33471 assert( db!=0 );
33462 assert( db->pParse==pParse ); 33472 assert( db->pParse==pParse || db->pParse->pToplevel==pParse );
33463 db->errByteOffset = -2; 33473 db->errByteOffset = -2;
33464 va_start(ap, zFormat); 33474 va_start(ap, zFormat);
33465 zMsg = sqlite3VMPrintf(db, zFormat, ap); 33475 zMsg = sqlite3VMPrintf(db, zFormat, ap);
@@ -41320,6 +41330,7 @@ static const char *unixTempFileDir(void){
41320static int unixGetTempname(int nBuf, char *zBuf){ 41330static int unixGetTempname(int nBuf, char *zBuf){
41321 const char *zDir; 41331 const char *zDir;
41322 int iLimit = 0; 41332 int iLimit = 0;
41333 int rc = SQLITE_OK;
41323 41334
41324 /* It's odd to simulate an io-error here, but really this is just 41335 /* It's odd to simulate an io-error here, but really this is just
41325 ** using the io-error infrastructure to test that SQLite handles this 41336 ** using the io-error infrastructure to test that SQLite handles this
@@ -41328,18 +41339,26 @@ static int unixGetTempname(int nBuf, char *zBuf){
41328 zBuf[0] = 0; 41339 zBuf[0] = 0;
41329 SimulateIOError( return SQLITE_IOERR ); 41340 SimulateIOError( return SQLITE_IOERR );
41330 41341
41342 sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
41331 zDir = unixTempFileDir(); 41343 zDir = unixTempFileDir();
41332 if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH; 41344 if( zDir==0 ){
41333 do{ 41345 rc = SQLITE_IOERR_GETTEMPPATH;
41334 u64 r; 41346 }else{
41335 sqlite3_randomness(sizeof(r), &r); 41347 do{
41336 assert( nBuf>2 ); 41348 u64 r;
41337 zBuf[nBuf-2] = 0; 41349 sqlite3_randomness(sizeof(r), &r);
41338 sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c", 41350 assert( nBuf>2 );
41339 zDir, r, 0); 41351 zBuf[nBuf-2] = 0;
41340 if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR; 41352 sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
41341 }while( osAccess(zBuf,0)==0 ); 41353 zDir, r, 0);
41342 return SQLITE_OK; 41354 if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){
41355 rc = SQLITE_ERROR;
41356 break;
41357 }
41358 }while( osAccess(zBuf,0)==0 );
41359 }
41360 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
41361 return rc;
41343} 41362}
41344 41363
41345#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) 41364#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
@@ -45482,6 +45501,7 @@ SQLITE_API int sqlite3_win32_set_directory8(
45482 int rc = sqlite3_initialize(); 45501 int rc = sqlite3_initialize();
45483 if( rc ) return rc; 45502 if( rc ) return rc;
45484#endif 45503#endif
45504 sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
45485 if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){ 45505 if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){
45486 ppDirectory = &sqlite3_data_directory; 45506 ppDirectory = &sqlite3_data_directory;
45487 }else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){ 45507 }else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){
@@ -45496,14 +45516,19 @@ SQLITE_API int sqlite3_win32_set_directory8(
45496 if( zValue && zValue[0] ){ 45516 if( zValue && zValue[0] ){
45497 zCopy = sqlite3_mprintf("%s", zValue); 45517 zCopy = sqlite3_mprintf("%s", zValue);
45498 if ( zCopy==0 ){ 45518 if ( zCopy==0 ){
45499 return SQLITE_NOMEM_BKPT; 45519 rc = SQLITE_NOMEM_BKPT;
45520 goto set_directory8_done;
45500 } 45521 }
45501 } 45522 }
45502 sqlite3_free(*ppDirectory); 45523 sqlite3_free(*ppDirectory);
45503 *ppDirectory = zCopy; 45524 *ppDirectory = zCopy;
45504 return SQLITE_OK; 45525 rc = SQLITE_OK;
45526 }else{
45527 rc = SQLITE_ERROR;
45505 } 45528 }
45506 return SQLITE_ERROR; 45529set_directory8_done:
45530 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
45531 return rc;
45507} 45532}
45508 45533
45509/* 45534/*
@@ -48278,6 +48303,18 @@ static int winMakeEndInDirSep(int nBuf, char *zBuf){
48278} 48303}
48279 48304
48280/* 48305/*
48306** If sqlite3_temp_directory is not, take the mutex and return true.
48307**
48308** If sqlite3_temp_directory is NULL, omit the mutex and return false.
48309*/
48310static int winTempDirDefined(void){
48311 sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48312 if( sqlite3_temp_directory!=0 ) return 1;
48313 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48314 return 0;
48315}
48316
48317/*
48281** Create a temporary file name and store the resulting pointer into pzBuf. 48318** Create a temporary file name and store the resulting pointer into pzBuf.
48282** The pointer returned in pzBuf must be freed via sqlite3_free(). 48319** The pointer returned in pzBuf must be freed via sqlite3_free().
48283*/ 48320*/
@@ -48313,20 +48350,23 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
48313 */ 48350 */
48314 nDir = nMax - (nPre + 15); 48351 nDir = nMax - (nPre + 15);
48315 assert( nDir>0 ); 48352 assert( nDir>0 );
48316 if( sqlite3_temp_directory ){ 48353 if( winTempDirDefined() ){
48317 int nDirLen = sqlite3Strlen30(sqlite3_temp_directory); 48354 int nDirLen = sqlite3Strlen30(sqlite3_temp_directory);
48318 if( nDirLen>0 ){ 48355 if( nDirLen>0 ){
48319 if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){ 48356 if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){
48320 nDirLen++; 48357 nDirLen++;
48321 } 48358 }
48322 if( nDirLen>nDir ){ 48359 if( nDirLen>nDir ){
48360 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48323 sqlite3_free(zBuf); 48361 sqlite3_free(zBuf);
48324 OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); 48362 OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
48325 return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0); 48363 return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0);
48326 } 48364 }
48327 sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory); 48365 sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory);
48328 } 48366 }
48367 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48329 } 48368 }
48369
48330#if defined(__CYGWIN__) 48370#if defined(__CYGWIN__)
48331 else{ 48371 else{
48332 static const char *azDirs[] = { 48372 static const char *azDirs[] = {
@@ -49115,7 +49155,7 @@ static BOOL winIsVerbatimPathname(
49115** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname 49155** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname
49116** bytes in size. 49156** bytes in size.
49117*/ 49157*/
49118static int winFullPathname( 49158static int winFullPathnameNoMutex(
49119 sqlite3_vfs *pVfs, /* Pointer to vfs object */ 49159 sqlite3_vfs *pVfs, /* Pointer to vfs object */
49120 const char *zRelative, /* Possibly relative input path */ 49160 const char *zRelative, /* Possibly relative input path */
49121 int nFull, /* Size of output buffer in bytes */ 49161 int nFull, /* Size of output buffer in bytes */
@@ -49294,6 +49334,19 @@ static int winFullPathname(
49294 } 49334 }
49295#endif 49335#endif
49296} 49336}
49337static int winFullPathname(
49338 sqlite3_vfs *pVfs, /* Pointer to vfs object */
49339 const char *zRelative, /* Possibly relative input path */
49340 int nFull, /* Size of output buffer in bytes */
49341 char *zFull /* Output buffer */
49342){
49343 int rc;
49344 sqlite3_mutex *pMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR);
49345 sqlite3_mutex_enter(pMutex);
49346 rc = winFullPathnameNoMutex(pVfs, zRelative, nFull, zFull);
49347 sqlite3_mutex_leave(pMutex);
49348 return rc;
49349}
49297 49350
49298#ifndef SQLITE_OMIT_LOAD_EXTENSION 49351#ifndef SQLITE_OMIT_LOAD_EXTENSION
49299/* 49352/*
@@ -59676,6 +59729,7 @@ static int pager_open_journal(Pager *pPager){
59676 if( rc!=SQLITE_OK ){ 59729 if( rc!=SQLITE_OK ){
59677 sqlite3BitvecDestroy(pPager->pInJournal); 59730 sqlite3BitvecDestroy(pPager->pInJournal);
59678 pPager->pInJournal = 0; 59731 pPager->pInJournal = 0;
59732 pPager->journalOff = 0;
59679 }else{ 59733 }else{
59680 assert( pPager->eState==PAGER_WRITER_LOCKED ); 59734 assert( pPager->eState==PAGER_WRITER_LOCKED );
59681 pPager->eState = PAGER_WRITER_CACHEMOD; 59735 pPager->eState = PAGER_WRITER_CACHEMOD;
@@ -61231,7 +61285,7 @@ SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
61231SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){ 61285SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
61232 assert( assert_pager_state(pPager) ); 61286 assert( assert_pager_state(pPager) );
61233 if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0; 61287 if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;
61234 if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0; 61288 if( isOpen(pPager->jfd) && pPager->journalOff>0 ) return 0;
61235 return 1; 61289 return 1;
61236} 61290}
61237 61291
@@ -81035,6 +81089,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(
81035 addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function, 81089 addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function,
81036 p1, p2, p3, (char*)pCtx, P4_FUNCCTX); 81090 p1, p2, p3, (char*)pCtx, P4_FUNCCTX);
81037 sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef); 81091 sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef);
81092 sqlite3MayAbort(pParse);
81038 return addr; 81093 return addr;
81039} 81094}
81040 81095
@@ -81370,6 +81425,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
81370 || opcode==OP_VDestroy 81425 || opcode==OP_VDestroy
81371 || opcode==OP_VCreate 81426 || opcode==OP_VCreate
81372 || opcode==OP_ParseSchema 81427 || opcode==OP_ParseSchema
81428 || opcode==OP_Function || opcode==OP_PureFunc
81373 || ((opcode==OP_Halt || opcode==OP_HaltIfNull) 81429 || ((opcode==OP_Halt || opcode==OP_HaltIfNull)
81374 && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort)) 81430 && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
81375 ){ 81431 ){
@@ -132704,6 +132760,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132704 ** 132760 **
132705 */ 132761 */
132706 case PragTyp_TEMP_STORE_DIRECTORY: { 132762 case PragTyp_TEMP_STORE_DIRECTORY: {
132763 sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132707 if( !zRight ){ 132764 if( !zRight ){
132708 returnSingleText(v, sqlite3_temp_directory); 132765 returnSingleText(v, sqlite3_temp_directory);
132709 }else{ 132766 }else{
@@ -132713,6 +132770,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132713 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); 132770 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
132714 if( rc!=SQLITE_OK || res==0 ){ 132771 if( rc!=SQLITE_OK || res==0 ){
132715 sqlite3ErrorMsg(pParse, "not a writable directory"); 132772 sqlite3ErrorMsg(pParse, "not a writable directory");
132773 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132716 goto pragma_out; 132774 goto pragma_out;
132717 } 132775 }
132718 } 132776 }
@@ -132730,6 +132788,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132730 } 132788 }
132731#endif /* SQLITE_OMIT_WSD */ 132789#endif /* SQLITE_OMIT_WSD */
132732 } 132790 }
132791 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132733 break; 132792 break;
132734 } 132793 }
132735 132794
@@ -132748,6 +132807,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132748 ** 132807 **
132749 */ 132808 */
132750 case PragTyp_DATA_STORE_DIRECTORY: { 132809 case PragTyp_DATA_STORE_DIRECTORY: {
132810 sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132751 if( !zRight ){ 132811 if( !zRight ){
132752 returnSingleText(v, sqlite3_data_directory); 132812 returnSingleText(v, sqlite3_data_directory);
132753 }else{ 132813 }else{
@@ -132757,6 +132817,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132757 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); 132817 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
132758 if( rc!=SQLITE_OK || res==0 ){ 132818 if( rc!=SQLITE_OK || res==0 ){
132759 sqlite3ErrorMsg(pParse, "not a writable directory"); 132819 sqlite3ErrorMsg(pParse, "not a writable directory");
132820 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132760 goto pragma_out; 132821 goto pragma_out;
132761 } 132822 }
132762 } 132823 }
@@ -132768,6 +132829,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
132768 } 132829 }
132769#endif /* SQLITE_OMIT_WSD */ 132830#endif /* SQLITE_OMIT_WSD */
132770 } 132831 }
132832 sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
132771 break; 132833 break;
132772 } 132834 }
132773#endif 132835#endif
@@ -137213,7 +137275,7 @@ static void generateSortTail(
137213 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); 137275 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
137214 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak); 137276 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
137215 VdbeCoverage(v); 137277 VdbeCoverage(v);
137216 codeOffset(v, p->iOffset, addrContinue); 137278 assert( p->iLimit==0 && p->iOffset==0 );
137217 sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab); 137279 sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);
137218 bSeq = 0; 137280 bSeq = 0;
137219 }else{ 137281 }else{
@@ -137221,6 +137283,9 @@ static void generateSortTail(
137221 codeOffset(v, p->iOffset, addrContinue); 137283 codeOffset(v, p->iOffset, addrContinue);
137222 iSortTab = iTab; 137284 iSortTab = iTab;
137223 bSeq = 1; 137285 bSeq = 1;
137286 if( p->iOffset>0 ){
137287 sqlite3VdbeAddOp2(v, OP_AddImm, p->iLimit, -1);
137288 }
137224 } 137289 }
137225 for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){ 137290 for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){
137226#ifdef SQLITE_ENABLE_SORTER_REFERENCES 137291#ifdef SQLITE_ENABLE_SORTER_REFERENCES
@@ -139213,10 +139278,11 @@ static int multiSelectOrderBy(
139213 */ 139278 */
139214 sqlite3VdbeResolveLabel(v, labelEnd); 139279 sqlite3VdbeResolveLabel(v, labelEnd);
139215 139280
139216 /* Reassembly the compound query so that it will be freed correctly 139281 /* Reassemble the compound query so that it will be freed correctly
139217 ** by the calling function */ 139282 ** by the calling function */
139218 if( pSplit->pPrior ){ 139283 if( pSplit->pPrior ){
139219 sqlite3SelectDelete(db, pSplit->pPrior); 139284 sqlite3ParserAddCleanup(pParse,
139285 (void(*)(sqlite3*,void*))sqlite3SelectDelete, pSplit->pPrior);
139220 } 139286 }
139221 pSplit->pPrior = pPrior; 139287 pSplit->pPrior = pPrior;
139222 pPrior->pNext = pSplit; 139288 pPrior->pNext = pSplit;
@@ -140735,6 +140801,7 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
140735 || p->pSrc->nSrc!=1 140801 || p->pSrc->nSrc!=1
140736 || p->pSrc->a[0].pSelect 140802 || p->pSrc->a[0].pSelect
140737 || pAggInfo->nFunc!=1 140803 || pAggInfo->nFunc!=1
140804 || p->pHaving
140738 ){ 140805 ){
140739 return 0; 140806 return 0;
140740 } 140807 }
@@ -149783,7 +149850,8 @@ static int codeEqualityTerm(
149783 } 149850 }
149784 sqlite3ExprDelete(db, pX); 149851 sqlite3ExprDelete(db, pX);
149785 }else{ 149852 }else{
149786 aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); 149853 int n = sqlite3ExprVectorSize(pX->pLeft);
149854 aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*MAX(nEq,n));
149787 eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); 149855 eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
149788 } 149856 }
149789 pX = pExpr; 149857 pX = pExpr;
@@ -181120,7 +181188,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
181120 nDistance = iPrev - nMaxUndeferred; 181188 nDistance = iPrev - nMaxUndeferred;
181121 } 181189 }
181122 181190
181123 aOut = (char *)sqlite3_malloc(nPoslist+8); 181191 aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING);
181124 if( !aOut ){ 181192 if( !aOut ){
181125 sqlite3_free(aPoslist); 181193 sqlite3_free(aPoslist);
181126 return SQLITE_NOMEM; 181194 return SQLITE_NOMEM;
@@ -204146,7 +204214,7 @@ static int geopolyUpdate(
204146 sqlite3_free(p); 204214 sqlite3_free(p);
204147 nChange = 1; 204215 nChange = 1;
204148 } 204216 }
204149 for(jj=1; jj<pRtree->nAux; jj++){ 204217 for(jj=1; jj<nData-2; jj++){
204150 nChange++; 204218 nChange++;
204151 sqlite3_bind_value(pUp, jj+2, aData[jj+2]); 204219 sqlite3_bind_value(pUp, jj+2, aData[jj+2]);
204152 } 204220 }
@@ -236636,7 +236704,7 @@ static void fts5SourceIdFunc(
236636){ 236704){
236637 assert( nArg==0 ); 236705 assert( nArg==0 );
236638 UNUSED_PARAM2(nArg, apUnused); 236706 UNUSED_PARAM2(nArg, apUnused);
236639 sqlite3_result_text(pCtx, "fts5: 2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603", -1, SQLITE_TRANSIENT); 236707 sqlite3_result_text(pCtx, "fts5: 2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8", -1, SQLITE_TRANSIENT);
236640} 236708}
236641 236709
236642/* 236710/*
diff --git a/c/sqlite3.h b/c/sqlite3.h
index f0df724..2868334 100644
--- a/c/sqlite3.h
+++ b/c/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
146** [sqlite3_libversion_number()], [sqlite3_sourceid()], 146** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147** [sqlite_version()] and [sqlite_source_id()]. 147** [sqlite_version()] and [sqlite_source_id()].
148*/ 148*/
149#define SQLITE_VERSION "3.39.2" 149#define SQLITE_VERSION "3.39.3"
150#define SQLITE_VERSION_NUMBER 3039002 150#define SQLITE_VERSION_NUMBER 3039003
151#define SQLITE_SOURCE_ID "2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603" 151#define SQLITE_SOURCE_ID "2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8"
152 152
153/* 153/*
154** CAPI3REF: Run-Time Library Version Numbers 154** CAPI3REF: Run-Time Library Version Numbers