| | @@ -1205,11 +1205,11 @@ |
| 1205 | 1205 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1206 | 1206 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1207 | 1207 | */ |
| 1208 | 1208 | #define SQLITE_VERSION "3.36.0" |
| 1209 | 1209 | #define SQLITE_VERSION_NUMBER 3036000 |
| 1210 | | -#define SQLITE_SOURCE_ID "2021-06-14 20:41:20 e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9ef70" |
| 1210 | +#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5" |
| 1211 | 1211 | |
| 1212 | 1212 | /* |
| 1213 | 1213 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1214 | 1214 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1215 | 1215 | ** |
| | @@ -5458,21 +5458,21 @@ |
| 5458 | 5458 | ** contain embedded NULs. The result of expressions involving strings |
| 5459 | 5459 | ** with embedded NULs is undefined. |
| 5460 | 5460 | ** |
| 5461 | 5461 | ** ^The fifth argument to the BLOB and string binding interfaces controls |
| 5462 | 5462 | ** or indicates the lifetime of the object referenced by the third parameter. |
| 5463 | | -** ^These three options exist: |
| 5464 | | -** ^(1) A destructor to dispose of the BLOB or string after SQLite has finished |
| 5463 | +** These three options exist: |
| 5464 | +** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished |
| 5465 | 5465 | ** with it may be passed. ^It is called to dispose of the BLOB or string even |
| 5466 | 5466 | ** if the call to the bind API fails, except the destructor is not called if |
| 5467 | 5467 | ** the third parameter is a NULL pointer or the fourth parameter is negative. |
| 5468 | | -** ^(2) The special constant, [SQLITE_STATIC], may be passsed to indicate that |
| 5468 | +** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that |
| 5469 | 5469 | ** the application remains responsible for disposing of the object. ^In this |
| 5470 | 5470 | ** case, the object and the provided pointer to it must remain valid until |
| 5471 | 5471 | ** either the prepared statement is finalized or the same SQL parameter is |
| 5472 | 5472 | ** bound to something else, whichever occurs sooner. |
| 5473 | | -** ^(3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the |
| 5473 | +** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the |
| 5474 | 5474 | ** object is to be copied prior to the return from sqlite3_bind_*(). ^The |
| 5475 | 5475 | ** object and pointer to it must remain valid until then. ^SQLite will then |
| 5476 | 5476 | ** manage the lifetime of its private copy. |
| 5477 | 5477 | ** |
| 5478 | 5478 | ** ^The sixth argument to sqlite3_bind_text64() must be one of |
| | @@ -30798,15 +30798,20 @@ |
| 30798 | 30798 | ** Nothing in this file or anywhere else in SQLite does any kind of |
| 30799 | 30799 | ** encryption. The RC4 algorithm is being used as a PRNG (pseudo-random |
| 30800 | 30800 | ** number generator) not as an encryption device. |
| 30801 | 30801 | */ |
| 30802 | 30802 | if( !wsdPrng.isInit ){ |
| 30803 | + sqlite3_vfs *pVfs = sqlite3_vfs_find(0); |
| 30803 | 30804 | int i; |
| 30804 | 30805 | char k[256]; |
| 30805 | 30806 | wsdPrng.j = 0; |
| 30806 | 30807 | wsdPrng.i = 0; |
| 30807 | | - sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k); |
| 30808 | + if( NEVER(pVfs==0) ){ |
| 30809 | + memset(k, 0, sizeof(k)); |
| 30810 | + }else{ |
| 30811 | + sqlite3OsRandomness(pVfs, 256, k); |
| 30812 | + } |
| 30808 | 30813 | for(i=0; i<256; i++){ |
| 30809 | 30814 | wsdPrng.s[i] = (u8)i; |
| 30810 | 30815 | } |
| 30811 | 30816 | for(i=0; i<256; i++){ |
| 30812 | 30817 | wsdPrng.j += wsdPrng.s[i] + k[i]; |
| | @@ -42119,10 +42124,11 @@ |
| 42119 | 42124 | for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ |
| 42120 | 42125 | sqlite3_vfs_register(&aVfs[i], i==0); |
| 42121 | 42126 | } |
| 42122 | 42127 | unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); |
| 42123 | 42128 | |
| 42129 | +#ifndef SQLITE_OMIT_WAL |
| 42124 | 42130 | /* Validate lock assumptions */ |
| 42125 | 42131 | assert( SQLITE_SHM_NLOCK==8 ); /* Number of available locks */ |
| 42126 | 42132 | assert( UNIX_SHM_BASE==120 ); /* Start of locking area */ |
| 42127 | 42133 | /* Locks: |
| 42128 | 42134 | ** WRITE UNIX_SHM_BASE 120 |
| | @@ -42134,10 +42140,12 @@ |
| 42134 | 42140 | ** READ-3 UNIX_SHM_BASE+6 126 |
| 42135 | 42141 | ** READ-4 UNIX_SHM_BASE+7 127 |
| 42136 | 42142 | ** DMS UNIX_SHM_BASE+8 128 |
| 42137 | 42143 | */ |
| 42138 | 42144 | assert( UNIX_SHM_DMS==128 ); /* Byte offset of the deadman-switch */ |
| 42145 | +#endif |
| 42146 | + |
| 42139 | 42147 | return SQLITE_OK; |
| 42140 | 42148 | } |
| 42141 | 42149 | |
| 42142 | 42150 | /* |
| 42143 | 42151 | ** Shutdown the operating system interface. |
| | @@ -49371,11 +49379,13 @@ |
| 49371 | 49379 | ** This routine is called when the extension is loaded. |
| 49372 | 49380 | ** Register the new VFS. |
| 49373 | 49381 | */ |
| 49374 | 49382 | SQLITE_PRIVATE int sqlite3MemdbInit(void){ |
| 49375 | 49383 | sqlite3_vfs *pLower = sqlite3_vfs_find(0); |
| 49376 | | - unsigned int sz = pLower->szOsFile; |
| 49384 | + unsigned int sz; |
| 49385 | + if( NEVER(pLower==0) ) return SQLITE_ERROR; |
| 49386 | + sz = pLower->szOsFile; |
| 49377 | 49387 | memdb_vfs.pAppData = pLower; |
| 49378 | 49388 | /* The following conditional can only be true when compiled for |
| 49379 | 49389 | ** Windows x86 and SQLITE_MAX_MMAP_SIZE=0. We always leave |
| 49380 | 49390 | ** it in, to be safe, but it is marked as NO_TEST since there |
| 49381 | 49391 | ** is no way to reach it under most builds. */ |
| | @@ -96378,12 +96388,13 @@ |
| 96378 | 96388 | int iTask = (pTask - pTask->pSorter->aTask); |
| 96379 | 96389 | sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); |
| 96380 | 96390 | fprintf(stderr, "%lld:%d %s\n", t, iTask, zEvent); |
| 96381 | 96391 | } |
| 96382 | 96392 | static void vdbeSorterRewindDebug(const char *zEvent){ |
| 96383 | | - i64 t; |
| 96384 | | - sqlite3OsCurrentTimeInt64(sqlite3_vfs_find(0), &t); |
| 96393 | + i64 t = 0; |
| 96394 | + sqlite3_vfs *pVfs = sqlite3_vfs_find(0); |
| 96395 | + if( ALWAYS(pVfs) ) sqlite3OsCurrentTimeInt64(pVfs, &t); |
| 96385 | 96396 | fprintf(stderr, "%lld:X %s\n", t, zEvent); |
| 96386 | 96397 | } |
| 96387 | 96398 | static void vdbeSorterPopulateDebug( |
| 96388 | 96399 | SortSubtask *pTask, |
| 96389 | 96400 | const char *zEvent |
| | @@ -108240,12 +108251,12 @@ |
| 108240 | 108251 | static int renameUnmapSelectCb(Walker *pWalker, Select *p){ |
| 108241 | 108252 | Parse *pParse = pWalker->pParse; |
| 108242 | 108253 | int i; |
| 108243 | 108254 | if( pParse->nErr ) return WRC_Abort; |
| 108244 | 108255 | if( p->selFlags & (SF_View|SF_CopyCte) ){ |
| 108245 | | - testcase( pSelect->selFlags & SF_View ); |
| 108246 | | - testcase( pSelect->selFlags & SF_CopyCte ); |
| 108256 | + testcase( p->selFlags & SF_View ); |
| 108257 | + testcase( p->selFlags & SF_CopyCte ); |
| 108247 | 108258 | return WRC_Prune; |
| 108248 | 108259 | } |
| 108249 | 108260 | if( ALWAYS(p->pEList) ){ |
| 108250 | 108261 | ExprList *pList = p->pEList; |
| 108251 | 108262 | for(i=0; i<pList->nExpr; i++){ |
| | @@ -108352,12 +108363,12 @@ |
| 108352 | 108363 | ** because without a dummy callback, sqlite3WalkExpr() and similar do not |
| 108353 | 108364 | ** descend into sub-select statements. |
| 108354 | 108365 | */ |
| 108355 | 108366 | static int renameColumnSelectCb(Walker *pWalker, Select *p){ |
| 108356 | 108367 | if( p->selFlags & (SF_View|SF_CopyCte) ){ |
| 108357 | | - testcase( pSelect->selFlags & SF_View ); |
| 108358 | | - testcase( pSelect->selFlags & SF_CopyCte ); |
| 108368 | + testcase( p->selFlags & SF_View ); |
| 108369 | + testcase( p->selFlags & SF_CopyCte ); |
| 108359 | 108370 | return WRC_Prune; |
| 108360 | 108371 | } |
| 108361 | 108372 | renameWalkWith(pWalker, p); |
| 108362 | 108373 | return WRC_Continue; |
| 108363 | 108374 | } |
| | @@ -108549,17 +108560,17 @@ |
| 108549 | 108560 | RenameCtx *pRename, /* Rename context */ |
| 108550 | 108561 | const char *zSql, /* SQL statement to edit */ |
| 108551 | 108562 | const char *zNew, /* New token text */ |
| 108552 | 108563 | int bQuote /* True to always quote token */ |
| 108553 | 108564 | ){ |
| 108554 | | - int nNew = sqlite3Strlen30(zNew); |
| 108555 | | - int nSql = sqlite3Strlen30(zSql); |
| 108565 | + i64 nNew = sqlite3Strlen30(zNew); |
| 108566 | + i64 nSql = sqlite3Strlen30(zSql); |
| 108556 | 108567 | sqlite3 *db = sqlite3_context_db_handle(pCtx); |
| 108557 | 108568 | int rc = SQLITE_OK; |
| 108558 | 108569 | char *zQuot = 0; |
| 108559 | 108570 | char *zOut; |
| 108560 | | - int nQuot = 0; |
| 108571 | + i64 nQuot = 0; |
| 108561 | 108572 | char *zBuf1 = 0; |
| 108562 | 108573 | char *zBuf2 = 0; |
| 108563 | 108574 | |
| 108564 | 108575 | if( zNew ){ |
| 108565 | 108576 | /* Set zQuot to point to a buffer containing a quoted copy of the |
| | @@ -120617,29 +120628,29 @@ |
| 120617 | 120628 | int argc, |
| 120618 | 120629 | sqlite3_value **argv |
| 120619 | 120630 | ){ |
| 120620 | 120631 | const unsigned char *zIn; /* Input string */ |
| 120621 | 120632 | const unsigned char *zCharSet; /* Set of characters to trim */ |
| 120622 | | - int nIn; /* Number of bytes in input */ |
| 120633 | + unsigned int nIn; /* Number of bytes in input */ |
| 120623 | 120634 | int flags; /* 1: trimleft 2: trimright 3: trim */ |
| 120624 | 120635 | int i; /* Loop counter */ |
| 120625 | | - unsigned char *aLen = 0; /* Length of each character in zCharSet */ |
| 120636 | + unsigned int *aLen = 0; /* Length of each character in zCharSet */ |
| 120626 | 120637 | unsigned char **azChar = 0; /* Individual characters in zCharSet */ |
| 120627 | 120638 | int nChar; /* Number of characters in zCharSet */ |
| 120628 | 120639 | |
| 120629 | 120640 | if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ |
| 120630 | 120641 | return; |
| 120631 | 120642 | } |
| 120632 | 120643 | zIn = sqlite3_value_text(argv[0]); |
| 120633 | 120644 | if( zIn==0 ) return; |
| 120634 | | - nIn = sqlite3_value_bytes(argv[0]); |
| 120645 | + nIn = (unsigned)sqlite3_value_bytes(argv[0]); |
| 120635 | 120646 | assert( zIn==sqlite3_value_text(argv[0]) ); |
| 120636 | 120647 | if( argc==1 ){ |
| 120637 | | - static const unsigned char lenOne[] = { 1 }; |
| 120648 | + static const unsigned lenOne[] = { 1 }; |
| 120638 | 120649 | static unsigned char * const azOne[] = { (u8*)" " }; |
| 120639 | 120650 | nChar = 1; |
| 120640 | | - aLen = (u8*)lenOne; |
| 120651 | + aLen = (unsigned*)lenOne; |
| 120641 | 120652 | azChar = (unsigned char **)azOne; |
| 120642 | 120653 | zCharSet = 0; |
| 120643 | 120654 | }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){ |
| 120644 | 120655 | return; |
| 120645 | 120656 | }else{ |
| | @@ -120646,27 +120657,28 @@ |
| 120646 | 120657 | const unsigned char *z; |
| 120647 | 120658 | for(z=zCharSet, nChar=0; *z; nChar++){ |
| 120648 | 120659 | SQLITE_SKIP_UTF8(z); |
| 120649 | 120660 | } |
| 120650 | 120661 | if( nChar>0 ){ |
| 120651 | | - azChar = contextMalloc(context, ((i64)nChar)*(sizeof(char*)+1)); |
| 120662 | + azChar = contextMalloc(context, |
| 120663 | + ((i64)nChar)*(sizeof(char*)+sizeof(unsigned))); |
| 120652 | 120664 | if( azChar==0 ){ |
| 120653 | 120665 | return; |
| 120654 | 120666 | } |
| 120655 | | - aLen = (unsigned char*)&azChar[nChar]; |
| 120667 | + aLen = (unsigned*)&azChar[nChar]; |
| 120656 | 120668 | for(z=zCharSet, nChar=0; *z; nChar++){ |
| 120657 | 120669 | azChar[nChar] = (unsigned char *)z; |
| 120658 | 120670 | SQLITE_SKIP_UTF8(z); |
| 120659 | | - aLen[nChar] = (u8)(z - azChar[nChar]); |
| 120671 | + aLen[nChar] = (unsigned)(z - azChar[nChar]); |
| 120660 | 120672 | } |
| 120661 | 120673 | } |
| 120662 | 120674 | } |
| 120663 | 120675 | if( nChar>0 ){ |
| 120664 | 120676 | flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context)); |
| 120665 | 120677 | if( flags & 1 ){ |
| 120666 | 120678 | while( nIn>0 ){ |
| 120667 | | - int len = 0; |
| 120679 | + unsigned int len = 0; |
| 120668 | 120680 | for(i=0; i<nChar; i++){ |
| 120669 | 120681 | len = aLen[i]; |
| 120670 | 120682 | if( len<=nIn && memcmp(zIn, azChar[i], len)==0 ) break; |
| 120671 | 120683 | } |
| 120672 | 120684 | if( i>=nChar ) break; |
| | @@ -120674,11 +120686,11 @@ |
| 120674 | 120686 | nIn -= len; |
| 120675 | 120687 | } |
| 120676 | 120688 | } |
| 120677 | 120689 | if( flags & 2 ){ |
| 120678 | 120690 | while( nIn>0 ){ |
| 120679 | | - int len = 0; |
| 120691 | + unsigned int len = 0; |
| 120680 | 120692 | for(i=0; i<nChar; i++){ |
| 120681 | 120693 | len = aLen[i]; |
| 120682 | 120694 | if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break; |
| 120683 | 120695 | } |
| 120684 | 120696 | if( i>=nChar ) break; |
| | @@ -151932,11 +151944,11 @@ |
| 151932 | 151944 | }else{ |
| 151933 | 151945 | #ifdef SQLITE_ENABLE_STAT4 |
| 151934 | 151946 | tRowcnt nOut = 0; |
| 151935 | 151947 | if( nInMul==0 |
| 151936 | 151948 | && pProbe->nSample |
| 151937 | | - && pNew->u.btree.nEq<=pProbe->nSampleCol |
| 151949 | + && ALWAYS(pNew->u.btree.nEq<=pProbe->nSampleCol) |
| 151938 | 151950 | && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect)) |
| 151939 | 151951 | && OptimizationEnabled(db, SQLITE_Stat4) |
| 151940 | 151952 | ){ |
| 151941 | 151953 | Expr *pExpr = pTerm->pExpr; |
| 151942 | 151954 | if( (eOp & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){ |
| | @@ -169349,11 +169361,11 @@ |
| 169349 | 169361 | case 3: sqlite3WhereTrace = *ptr; break; |
| 169350 | 169362 | } |
| 169351 | 169363 | break; |
| 169352 | 169364 | } |
| 169353 | 169365 | |
| 169354 | | -#ifdef SQLITE_DEBUG |
| 169366 | +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD) |
| 169355 | 169367 | /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue) |
| 169356 | 169368 | ** |
| 169357 | 169369 | ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value |
| 169358 | 169370 | ** of the id-th tuning parameter to *piValue. If "id" is between -1 |
| 169359 | 169371 | ** and -SQLITE_NTUNE, then write the current value of the (-id)-th |
| | @@ -230568,11 +230580,11 @@ |
| 230568 | 230580 | int nArg, /* Number of args */ |
| 230569 | 230581 | sqlite3_value **apUnused /* Function arguments */ |
| 230570 | 230582 | ){ |
| 230571 | 230583 | assert( nArg==0 ); |
| 230572 | 230584 | UNUSED_PARAM2(nArg, apUnused); |
| 230573 | | - sqlite3_result_text(pCtx, "fts5: 2021-06-14 20:41:20 e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9ef70", -1, SQLITE_TRANSIENT); |
| 230585 | + sqlite3_result_text(pCtx, "fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5", -1, SQLITE_TRANSIENT); |
| 230574 | 230586 | } |
| 230575 | 230587 | |
| 230576 | 230588 | /* |
| 230577 | 230589 | ** Return true if zName is the extension on one of the shadow tables used |
| 230578 | 230590 | ** by this module. |
| | @@ -235494,12 +235506,12 @@ |
| 235494 | 235506 | } |
| 235495 | 235507 | #endif /* SQLITE_CORE */ |
| 235496 | 235508 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 235497 | 235509 | |
| 235498 | 235510 | /************** End of stmt.c ************************************************/ |
| 235499 | | -#if __LINE__!=235499 |
| 235511 | +#if __LINE__!=235511 |
| 235500 | 235512 | #undef SQLITE_SOURCE_ID |
| 235501 | | -#define SQLITE_SOURCE_ID "2021-06-14 20:41:20 e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9alt2" |
| 235513 | +#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafaalt2" |
| 235502 | 235514 | #endif |
| 235503 | 235515 | /* Return the source-id for this library */ |
| 235504 | 235516 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 235505 | 235517 | /************************** End of sqlite3.c ******************************/ |
| 235506 | 235518 | |