Fossil SCM
Update the internal SQLite to the latest 3.7.4 pre-release snapshot.
Commit
0018d724b327ae1f4a648ce7d0772cd11ba4015f
Parent
bd75ea06b8d4f74…
2 files changed
+36
-17
+3
-2
+36
-17
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -650,11 +650,11 @@ | ||
| 650 | 650 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 651 | 651 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 652 | 652 | */ |
| 653 | 653 | #define SQLITE_VERSION "3.7.4" |
| 654 | 654 | #define SQLITE_VERSION_NUMBER 3007004 |
| 655 | -#define SQLITE_SOURCE_ID "2010-12-02 11:24:58 a94b9a395e0be9549d8c28e2b86b995c73c7b671" | |
| 655 | +#define SQLITE_SOURCE_ID "2010-12-06 21:09:59 fabcb6b95e1d4059d1e6c6183f65846f6cbd5749" | |
| 656 | 656 | |
| 657 | 657 | /* |
| 658 | 658 | ** CAPI3REF: Run-Time Library Version Numbers |
| 659 | 659 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 660 | 660 | ** |
| @@ -5381,11 +5381,12 @@ | ||
| 5381 | 5381 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 5382 | 5382 | ** it does not contain a blob or text value, or if another error occurs, an |
| 5383 | 5383 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 5384 | 5384 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 5385 | 5385 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 5386 | -** SQLITE_ABORT. | |
| 5386 | +** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle | |
| 5387 | +** always returns zero. | |
| 5387 | 5388 | ** |
| 5388 | 5389 | ** ^This function sets the database handle error code and message. |
| 5389 | 5390 | */ |
| 5390 | 5391 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 5391 | 5392 | |
| @@ -9071,10 +9072,11 @@ | ||
| 9071 | 9072 | #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 9072 | 9073 | #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 9073 | 9074 | #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 9074 | 9075 | #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 9075 | 9076 | #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 9077 | +#define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ | |
| 9076 | 9078 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9077 | 9079 | |
| 9078 | 9080 | /* |
| 9079 | 9081 | ** Possible values for the sqlite.magic field. |
| 9080 | 9082 | ** The numbers are obtained at random and have no special meaning, other |
| @@ -46906,21 +46908,17 @@ | ||
| 46906 | 46908 | |
| 46907 | 46909 | /* True if opening an ephemeral, temporary database */ |
| 46908 | 46910 | const int isTempDb = zFilename==0 || zFilename[0]==0; |
| 46909 | 46911 | |
| 46910 | 46912 | /* Set the variable isMemdb to true for an in-memory database, or |
| 46911 | - ** false for a file-based database. This symbol is only required if | |
| 46912 | - ** either of the shared-data or autovacuum features are compiled | |
| 46913 | - ** into the library. | |
| 46913 | + ** false for a file-based database. | |
| 46914 | 46914 | */ |
| 46915 | -#if !defined(SQLITE_OMIT_SHARED_CACHE) || !defined(SQLITE_OMIT_AUTOVACUUM) | |
| 46916 | - #ifdef SQLITE_OMIT_MEMORYDB | |
| 46917 | - const int isMemdb = 0; | |
| 46918 | - #else | |
| 46919 | - const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) | |
| 46920 | - || (isTempDb && sqlite3TempInMemory(db)); | |
| 46921 | - #endif | |
| 46915 | +#ifdef SQLITE_OMIT_MEMORYDB | |
| 46916 | + const int isMemdb = 0; | |
| 46917 | +#else | |
| 46918 | + const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) | |
| 46919 | + || (isTempDb && sqlite3TempInMemory(db)); | |
| 46922 | 46920 | #endif |
| 46923 | 46921 | |
| 46924 | 46922 | assert( db!=0 ); |
| 46925 | 46923 | assert( sqlite3_mutex_held(db->mutex) ); |
| 46926 | 46924 | assert( (flags&0xff)==flags ); /* flags fit in 8 bits */ |
| @@ -61775,11 +61773,10 @@ | ||
| 61775 | 61773 | ** without data loss, then jump immediately to P2, or if P2==0 |
| 61776 | 61774 | ** raise an SQLITE_MISMATCH exception. |
| 61777 | 61775 | */ |
| 61778 | 61776 | case OP_MustBeInt: { /* jump, in1 */ |
| 61779 | 61777 | pIn1 = &aMem[pOp->p1]; |
| 61780 | - memAboutToChange(p, pIn1); | |
| 61781 | 61778 | applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); |
| 61782 | 61779 | if( (pIn1->flags & MEM_Int)==0 ){ |
| 61783 | 61780 | if( pOp->p2==0 ){ |
| 61784 | 61781 | rc = SQLITE_MISMATCH; |
| 61785 | 61782 | goto abort_due_to_error; |
| @@ -66754,11 +66751,11 @@ | ||
| 66754 | 66751 | ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob |
| 66755 | 66752 | ** so no mutex is required for access. |
| 66756 | 66753 | */ |
| 66757 | 66754 | SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ |
| 66758 | 66755 | Incrblob *p = (Incrblob *)pBlob; |
| 66759 | - return p ? p->nByte : 0; | |
| 66756 | + return (p && p->pStmt) ? p->nByte : 0; | |
| 66760 | 66757 | } |
| 66761 | 66758 | |
| 66762 | 66759 | /* |
| 66763 | 66760 | ** Move an existing blob handle to point to a different row of the same |
| 66764 | 66761 | ** database table. |
| @@ -66792,10 +66789,11 @@ | ||
| 66792 | 66789 | } |
| 66793 | 66790 | assert( rc!=SQLITE_SCHEMA ); |
| 66794 | 66791 | } |
| 66795 | 66792 | |
| 66796 | 66793 | rc = sqlite3ApiExit(db, rc); |
| 66794 | + assert( rc==SQLITE_OK || p->pStmt==0 ); | |
| 66797 | 66795 | sqlite3_mutex_leave(db->mutex); |
| 66798 | 66796 | return rc; |
| 66799 | 66797 | } |
| 66800 | 66798 | |
| 66801 | 66799 | #endif /* #ifndef SQLITE_OMIT_INCRBLOB */ |
| @@ -70297,10 +70295,11 @@ | ||
| 70297 | 70295 | |
| 70298 | 70296 | assert( !isRowid ); |
| 70299 | 70297 | sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); |
| 70300 | 70298 | dest.affinity = (u8)affinity; |
| 70301 | 70299 | assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); |
| 70300 | + pExpr->x.pSelect->iLimit = 0; | |
| 70302 | 70301 | if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){ |
| 70303 | 70302 | return 0; |
| 70304 | 70303 | } |
| 70305 | 70304 | pEList = pExpr->x.pSelect->pEList; |
| 70306 | 70305 | if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ |
| @@ -70397,10 +70396,11 @@ | ||
| 70397 | 70396 | VdbeComment((v, "Init EXISTS result")); |
| 70398 | 70397 | } |
| 70399 | 70398 | sqlite3ExprDelete(pParse->db, pSel->pLimit); |
| 70400 | 70399 | pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, |
| 70401 | 70400 | &sqlite3IntTokens[1]); |
| 70401 | + pSel->iLimit = 0; | |
| 70402 | 70402 | if( sqlite3Select(pParse, pSel, &dest) ){ |
| 70403 | 70403 | return 0; |
| 70404 | 70404 | } |
| 70405 | 70405 | rReg = dest.iParm; |
| 70406 | 70406 | ExprSetIrreducible(pExpr); |
| @@ -71680,13 +71680,26 @@ | ||
| 71680 | 71680 | |
| 71681 | 71681 | /* |
| 71682 | 71682 | ** Preevaluate constant subexpressions within pExpr and store the |
| 71683 | 71683 | ** results in registers. Modify pExpr so that the constant subexpresions |
| 71684 | 71684 | ** are TK_REGISTER opcodes that refer to the precomputed values. |
| 71685 | +** | |
| 71686 | +** This routine is a no-op if the jump to the cookie-check code has | |
| 71687 | +** already occur. Since the cookie-check jump is generated prior to | |
| 71688 | +** any other serious processing, this check ensures that there is no | |
| 71689 | +** way to accidently bypass the constant initializations. | |
| 71690 | +** | |
| 71691 | +** This routine is also a no-op if the SQLITE_FactorOutConst optimization | |
| 71692 | +** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) | |
| 71693 | +** interface. This allows test logic to verify that the same answer is | |
| 71694 | +** obtained for queries regardless of whether or not constants are | |
| 71695 | +** precomputed into registers or if they are inserted in-line. | |
| 71685 | 71696 | */ |
| 71686 | 71697 | SQLITE_PRIVATE void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){ |
| 71687 | 71698 | Walker w; |
| 71699 | + if( pParse->cookieGoto ) return; | |
| 71700 | + if( (pParse->db->flags & SQLITE_FactorOutConst)!=0 ) return; | |
| 71688 | 71701 | w.xExprCallback = evalConstExpr; |
| 71689 | 71702 | w.xSelectCallback = 0; |
| 71690 | 71703 | w.pParse = pParse; |
| 71691 | 71704 | sqlite3WalkExpr(&w, pExpr); |
| 71692 | 71705 | } |
| @@ -109240,11 +109253,11 @@ | ||
| 109240 | 109253 | ** table, then there are always 20 bytes of zeroed padding following the |
| 109241 | 109254 | ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details). |
| 109242 | 109255 | */ |
| 109243 | 109256 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109244 | 109257 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109245 | - if( zCsr>=zEnd ){ | |
| 109258 | + if( zCsr>zEnd ){ | |
| 109246 | 109259 | return SQLITE_CORRUPT; |
| 109247 | 109260 | } |
| 109248 | 109261 | |
| 109249 | 109262 | while( zCsr<zEnd && (piFirst || piLast) ){ |
| 109250 | 109263 | int cmp; /* memcmp() result */ |
| @@ -110871,12 +110884,17 @@ | ||
| 110871 | 110884 | } |
| 110872 | 110885 | } |
| 110873 | 110886 | } |
| 110874 | 110887 | } |
| 110875 | 110888 | |
| 110876 | - *paOut = aRet; | |
| 110877 | - *pnOut = nRet; | |
| 110889 | + if( rc==SQLITE_OK ){ | |
| 110890 | + *paOut = aRet; | |
| 110891 | + *pnOut = nRet; | |
| 110892 | + }else{ | |
| 110893 | + assert( *paOut==0 ); | |
| 110894 | + sqlite3_free(aRet); | |
| 110895 | + } | |
| 110878 | 110896 | sqlite3_free(aExpr); |
| 110879 | 110897 | fts3ExprFreeSegReaders(pExpr); |
| 110880 | 110898 | |
| 110881 | 110899 | }else{ |
| 110882 | 110900 | char *aLeft; |
| @@ -110945,10 +110963,11 @@ | ||
| 110945 | 110963 | } |
| 110946 | 110964 | sqlite3_free(aRight); |
| 110947 | 110965 | } |
| 110948 | 110966 | } |
| 110949 | 110967 | |
| 110968 | + assert( rc==SQLITE_OK || *paOut==0 ); | |
| 110950 | 110969 | return rc; |
| 110951 | 110970 | } |
| 110952 | 110971 | |
| 110953 | 110972 | /* |
| 110954 | 110973 | ** This function is called from within xNext() for each row visited by |
| 110955 | 110974 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -650,11 +650,11 @@ | |
| 650 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 651 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 652 | */ |
| 653 | #define SQLITE_VERSION "3.7.4" |
| 654 | #define SQLITE_VERSION_NUMBER 3007004 |
| 655 | #define SQLITE_SOURCE_ID "2010-12-02 11:24:58 a94b9a395e0be9549d8c28e2b86b995c73c7b671" |
| 656 | |
| 657 | /* |
| 658 | ** CAPI3REF: Run-Time Library Version Numbers |
| 659 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 660 | ** |
| @@ -5381,11 +5381,12 @@ | |
| 5381 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 5382 | ** it does not contain a blob or text value, or if another error occurs, an |
| 5383 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 5384 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 5385 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 5386 | ** SQLITE_ABORT. |
| 5387 | ** |
| 5388 | ** ^This function sets the database handle error code and message. |
| 5389 | */ |
| 5390 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 5391 | |
| @@ -9071,10 +9072,11 @@ | |
| 9071 | #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 9072 | #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 9073 | #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 9074 | #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 9075 | #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 9076 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9077 | |
| 9078 | /* |
| 9079 | ** Possible values for the sqlite.magic field. |
| 9080 | ** The numbers are obtained at random and have no special meaning, other |
| @@ -46906,21 +46908,17 @@ | |
| 46906 | |
| 46907 | /* True if opening an ephemeral, temporary database */ |
| 46908 | const int isTempDb = zFilename==0 || zFilename[0]==0; |
| 46909 | |
| 46910 | /* Set the variable isMemdb to true for an in-memory database, or |
| 46911 | ** false for a file-based database. This symbol is only required if |
| 46912 | ** either of the shared-data or autovacuum features are compiled |
| 46913 | ** into the library. |
| 46914 | */ |
| 46915 | #if !defined(SQLITE_OMIT_SHARED_CACHE) || !defined(SQLITE_OMIT_AUTOVACUUM) |
| 46916 | #ifdef SQLITE_OMIT_MEMORYDB |
| 46917 | const int isMemdb = 0; |
| 46918 | #else |
| 46919 | const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) |
| 46920 | || (isTempDb && sqlite3TempInMemory(db)); |
| 46921 | #endif |
| 46922 | #endif |
| 46923 | |
| 46924 | assert( db!=0 ); |
| 46925 | assert( sqlite3_mutex_held(db->mutex) ); |
| 46926 | assert( (flags&0xff)==flags ); /* flags fit in 8 bits */ |
| @@ -61775,11 +61773,10 @@ | |
| 61775 | ** without data loss, then jump immediately to P2, or if P2==0 |
| 61776 | ** raise an SQLITE_MISMATCH exception. |
| 61777 | */ |
| 61778 | case OP_MustBeInt: { /* jump, in1 */ |
| 61779 | pIn1 = &aMem[pOp->p1]; |
| 61780 | memAboutToChange(p, pIn1); |
| 61781 | applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); |
| 61782 | if( (pIn1->flags & MEM_Int)==0 ){ |
| 61783 | if( pOp->p2==0 ){ |
| 61784 | rc = SQLITE_MISMATCH; |
| 61785 | goto abort_due_to_error; |
| @@ -66754,11 +66751,11 @@ | |
| 66754 | ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob |
| 66755 | ** so no mutex is required for access. |
| 66756 | */ |
| 66757 | SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ |
| 66758 | Incrblob *p = (Incrblob *)pBlob; |
| 66759 | return p ? p->nByte : 0; |
| 66760 | } |
| 66761 | |
| 66762 | /* |
| 66763 | ** Move an existing blob handle to point to a different row of the same |
| 66764 | ** database table. |
| @@ -66792,10 +66789,11 @@ | |
| 66792 | } |
| 66793 | assert( rc!=SQLITE_SCHEMA ); |
| 66794 | } |
| 66795 | |
| 66796 | rc = sqlite3ApiExit(db, rc); |
| 66797 | sqlite3_mutex_leave(db->mutex); |
| 66798 | return rc; |
| 66799 | } |
| 66800 | |
| 66801 | #endif /* #ifndef SQLITE_OMIT_INCRBLOB */ |
| @@ -70297,10 +70295,11 @@ | |
| 70297 | |
| 70298 | assert( !isRowid ); |
| 70299 | sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); |
| 70300 | dest.affinity = (u8)affinity; |
| 70301 | assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); |
| 70302 | if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){ |
| 70303 | return 0; |
| 70304 | } |
| 70305 | pEList = pExpr->x.pSelect->pEList; |
| 70306 | if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ |
| @@ -70397,10 +70396,11 @@ | |
| 70397 | VdbeComment((v, "Init EXISTS result")); |
| 70398 | } |
| 70399 | sqlite3ExprDelete(pParse->db, pSel->pLimit); |
| 70400 | pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, |
| 70401 | &sqlite3IntTokens[1]); |
| 70402 | if( sqlite3Select(pParse, pSel, &dest) ){ |
| 70403 | return 0; |
| 70404 | } |
| 70405 | rReg = dest.iParm; |
| 70406 | ExprSetIrreducible(pExpr); |
| @@ -71680,13 +71680,26 @@ | |
| 71680 | |
| 71681 | /* |
| 71682 | ** Preevaluate constant subexpressions within pExpr and store the |
| 71683 | ** results in registers. Modify pExpr so that the constant subexpresions |
| 71684 | ** are TK_REGISTER opcodes that refer to the precomputed values. |
| 71685 | */ |
| 71686 | SQLITE_PRIVATE void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){ |
| 71687 | Walker w; |
| 71688 | w.xExprCallback = evalConstExpr; |
| 71689 | w.xSelectCallback = 0; |
| 71690 | w.pParse = pParse; |
| 71691 | sqlite3WalkExpr(&w, pExpr); |
| 71692 | } |
| @@ -109240,11 +109253,11 @@ | |
| 109240 | ** table, then there are always 20 bytes of zeroed padding following the |
| 109241 | ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details). |
| 109242 | */ |
| 109243 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109244 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109245 | if( zCsr>=zEnd ){ |
| 109246 | return SQLITE_CORRUPT; |
| 109247 | } |
| 109248 | |
| 109249 | while( zCsr<zEnd && (piFirst || piLast) ){ |
| 109250 | int cmp; /* memcmp() result */ |
| @@ -110871,12 +110884,17 @@ | |
| 110871 | } |
| 110872 | } |
| 110873 | } |
| 110874 | } |
| 110875 | |
| 110876 | *paOut = aRet; |
| 110877 | *pnOut = nRet; |
| 110878 | sqlite3_free(aExpr); |
| 110879 | fts3ExprFreeSegReaders(pExpr); |
| 110880 | |
| 110881 | }else{ |
| 110882 | char *aLeft; |
| @@ -110945,10 +110963,11 @@ | |
| 110945 | } |
| 110946 | sqlite3_free(aRight); |
| 110947 | } |
| 110948 | } |
| 110949 | |
| 110950 | return rc; |
| 110951 | } |
| 110952 | |
| 110953 | /* |
| 110954 | ** This function is called from within xNext() for each row visited by |
| 110955 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -650,11 +650,11 @@ | |
| 650 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 651 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 652 | */ |
| 653 | #define SQLITE_VERSION "3.7.4" |
| 654 | #define SQLITE_VERSION_NUMBER 3007004 |
| 655 | #define SQLITE_SOURCE_ID "2010-12-06 21:09:59 fabcb6b95e1d4059d1e6c6183f65846f6cbd5749" |
| 656 | |
| 657 | /* |
| 658 | ** CAPI3REF: Run-Time Library Version Numbers |
| 659 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 660 | ** |
| @@ -5381,11 +5381,12 @@ | |
| 5381 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 5382 | ** it does not contain a blob or text value, or if another error occurs, an |
| 5383 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 5384 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 5385 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 5386 | ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle |
| 5387 | ** always returns zero. |
| 5388 | ** |
| 5389 | ** ^This function sets the database handle error code and message. |
| 5390 | */ |
| 5391 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 5392 | |
| @@ -9071,10 +9072,11 @@ | |
| 9072 | #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 9073 | #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 9074 | #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 9075 | #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 9076 | #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 9077 | #define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ |
| 9078 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9079 | |
| 9080 | /* |
| 9081 | ** Possible values for the sqlite.magic field. |
| 9082 | ** The numbers are obtained at random and have no special meaning, other |
| @@ -46906,21 +46908,17 @@ | |
| 46908 | |
| 46909 | /* True if opening an ephemeral, temporary database */ |
| 46910 | const int isTempDb = zFilename==0 || zFilename[0]==0; |
| 46911 | |
| 46912 | /* Set the variable isMemdb to true for an in-memory database, or |
| 46913 | ** false for a file-based database. |
| 46914 | */ |
| 46915 | #ifdef SQLITE_OMIT_MEMORYDB |
| 46916 | const int isMemdb = 0; |
| 46917 | #else |
| 46918 | const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) |
| 46919 | || (isTempDb && sqlite3TempInMemory(db)); |
| 46920 | #endif |
| 46921 | |
| 46922 | assert( db!=0 ); |
| 46923 | assert( sqlite3_mutex_held(db->mutex) ); |
| 46924 | assert( (flags&0xff)==flags ); /* flags fit in 8 bits */ |
| @@ -61775,11 +61773,10 @@ | |
| 61773 | ** without data loss, then jump immediately to P2, or if P2==0 |
| 61774 | ** raise an SQLITE_MISMATCH exception. |
| 61775 | */ |
| 61776 | case OP_MustBeInt: { /* jump, in1 */ |
| 61777 | pIn1 = &aMem[pOp->p1]; |
| 61778 | applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); |
| 61779 | if( (pIn1->flags & MEM_Int)==0 ){ |
| 61780 | if( pOp->p2==0 ){ |
| 61781 | rc = SQLITE_MISMATCH; |
| 61782 | goto abort_due_to_error; |
| @@ -66754,11 +66751,11 @@ | |
| 66751 | ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob |
| 66752 | ** so no mutex is required for access. |
| 66753 | */ |
| 66754 | SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ |
| 66755 | Incrblob *p = (Incrblob *)pBlob; |
| 66756 | return (p && p->pStmt) ? p->nByte : 0; |
| 66757 | } |
| 66758 | |
| 66759 | /* |
| 66760 | ** Move an existing blob handle to point to a different row of the same |
| 66761 | ** database table. |
| @@ -66792,10 +66789,11 @@ | |
| 66789 | } |
| 66790 | assert( rc!=SQLITE_SCHEMA ); |
| 66791 | } |
| 66792 | |
| 66793 | rc = sqlite3ApiExit(db, rc); |
| 66794 | assert( rc==SQLITE_OK || p->pStmt==0 ); |
| 66795 | sqlite3_mutex_leave(db->mutex); |
| 66796 | return rc; |
| 66797 | } |
| 66798 | |
| 66799 | #endif /* #ifndef SQLITE_OMIT_INCRBLOB */ |
| @@ -70297,10 +70295,11 @@ | |
| 70295 | |
| 70296 | assert( !isRowid ); |
| 70297 | sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); |
| 70298 | dest.affinity = (u8)affinity; |
| 70299 | assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); |
| 70300 | pExpr->x.pSelect->iLimit = 0; |
| 70301 | if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){ |
| 70302 | return 0; |
| 70303 | } |
| 70304 | pEList = pExpr->x.pSelect->pEList; |
| 70305 | if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ |
| @@ -70397,10 +70396,11 @@ | |
| 70396 | VdbeComment((v, "Init EXISTS result")); |
| 70397 | } |
| 70398 | sqlite3ExprDelete(pParse->db, pSel->pLimit); |
| 70399 | pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, |
| 70400 | &sqlite3IntTokens[1]); |
| 70401 | pSel->iLimit = 0; |
| 70402 | if( sqlite3Select(pParse, pSel, &dest) ){ |
| 70403 | return 0; |
| 70404 | } |
| 70405 | rReg = dest.iParm; |
| 70406 | ExprSetIrreducible(pExpr); |
| @@ -71680,13 +71680,26 @@ | |
| 71680 | |
| 71681 | /* |
| 71682 | ** Preevaluate constant subexpressions within pExpr and store the |
| 71683 | ** results in registers. Modify pExpr so that the constant subexpresions |
| 71684 | ** are TK_REGISTER opcodes that refer to the precomputed values. |
| 71685 | ** |
| 71686 | ** This routine is a no-op if the jump to the cookie-check code has |
| 71687 | ** already occur. Since the cookie-check jump is generated prior to |
| 71688 | ** any other serious processing, this check ensures that there is no |
| 71689 | ** way to accidently bypass the constant initializations. |
| 71690 | ** |
| 71691 | ** This routine is also a no-op if the SQLITE_FactorOutConst optimization |
| 71692 | ** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) |
| 71693 | ** interface. This allows test logic to verify that the same answer is |
| 71694 | ** obtained for queries regardless of whether or not constants are |
| 71695 | ** precomputed into registers or if they are inserted in-line. |
| 71696 | */ |
| 71697 | SQLITE_PRIVATE void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){ |
| 71698 | Walker w; |
| 71699 | if( pParse->cookieGoto ) return; |
| 71700 | if( (pParse->db->flags & SQLITE_FactorOutConst)!=0 ) return; |
| 71701 | w.xExprCallback = evalConstExpr; |
| 71702 | w.xSelectCallback = 0; |
| 71703 | w.pParse = pParse; |
| 71704 | sqlite3WalkExpr(&w, pExpr); |
| 71705 | } |
| @@ -109240,11 +109253,11 @@ | |
| 109253 | ** table, then there are always 20 bytes of zeroed padding following the |
| 109254 | ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details). |
| 109255 | */ |
| 109256 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109257 | zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); |
| 109258 | if( zCsr>zEnd ){ |
| 109259 | return SQLITE_CORRUPT; |
| 109260 | } |
| 109261 | |
| 109262 | while( zCsr<zEnd && (piFirst || piLast) ){ |
| 109263 | int cmp; /* memcmp() result */ |
| @@ -110871,12 +110884,17 @@ | |
| 110884 | } |
| 110885 | } |
| 110886 | } |
| 110887 | } |
| 110888 | |
| 110889 | if( rc==SQLITE_OK ){ |
| 110890 | *paOut = aRet; |
| 110891 | *pnOut = nRet; |
| 110892 | }else{ |
| 110893 | assert( *paOut==0 ); |
| 110894 | sqlite3_free(aRet); |
| 110895 | } |
| 110896 | sqlite3_free(aExpr); |
| 110897 | fts3ExprFreeSegReaders(pExpr); |
| 110898 | |
| 110899 | }else{ |
| 110900 | char *aLeft; |
| @@ -110945,10 +110963,11 @@ | |
| 110963 | } |
| 110964 | sqlite3_free(aRight); |
| 110965 | } |
| 110966 | } |
| 110967 | |
| 110968 | assert( rc==SQLITE_OK || *paOut==0 ); |
| 110969 | return rc; |
| 110970 | } |
| 110971 | |
| 110972 | /* |
| 110973 | ** This function is called from within xNext() for each row visited by |
| 110974 |
+3
-2
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.7.4" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3007004 |
| 112 | -#define SQLITE_SOURCE_ID "2010-12-02 11:24:58 a94b9a395e0be9549d8c28e2b86b995c73c7b671" | |
| 112 | +#define SQLITE_SOURCE_ID "2010-12-06 21:09:59 fabcb6b95e1d4059d1e6c6183f65846f6cbd5749" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -4838,11 +4838,12 @@ | ||
| 4838 | 4838 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 4839 | 4839 | ** it does not contain a blob or text value, or if another error occurs, an |
| 4840 | 4840 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 4841 | 4841 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 4842 | 4842 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 4843 | -** SQLITE_ABORT. | |
| 4843 | +** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle | |
| 4844 | +** always returns zero. | |
| 4844 | 4845 | ** |
| 4845 | 4846 | ** ^This function sets the database handle error code and message. |
| 4846 | 4847 | */ |
| 4847 | 4848 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 4848 | 4849 | |
| 4849 | 4850 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.4" |
| 111 | #define SQLITE_VERSION_NUMBER 3007004 |
| 112 | #define SQLITE_SOURCE_ID "2010-12-02 11:24:58 a94b9a395e0be9549d8c28e2b86b995c73c7b671" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -4838,11 +4838,12 @@ | |
| 4838 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 4839 | ** it does not contain a blob or text value, or if another error occurs, an |
| 4840 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 4841 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 4842 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 4843 | ** SQLITE_ABORT. |
| 4844 | ** |
| 4845 | ** ^This function sets the database handle error code and message. |
| 4846 | */ |
| 4847 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 4848 | |
| 4849 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.4" |
| 111 | #define SQLITE_VERSION_NUMBER 3007004 |
| 112 | #define SQLITE_SOURCE_ID "2010-12-06 21:09:59 fabcb6b95e1d4059d1e6c6183f65846f6cbd5749" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -4838,11 +4838,12 @@ | |
| 4838 | ** the nominated column.)^ ^If the new row is not present in the table, or if |
| 4839 | ** it does not contain a blob or text value, or if another error occurs, an |
| 4840 | ** SQLite error code is returned and the blob handle is considered aborted. |
| 4841 | ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or |
| 4842 | ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return |
| 4843 | ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle |
| 4844 | ** always returns zero. |
| 4845 | ** |
| 4846 | ** ^This function sets the database handle error code and message. |
| 4847 | */ |
| 4848 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 4849 | |
| 4850 |