Fossil SCM
Update the built-in SQLite to version 3.9.2
Commit
aa92270fe96d4923307f68f7e0743739042eebf3
Parent
9ecbfb372498ae6…
2 files changed
+58
-38
+3
-3
+58
-38
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | -** version 3.9.1. By combining all the individual C code files into this | |
| 3 | +** version 3.9.2. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -323,13 +323,13 @@ | ||
| 323 | 323 | ** |
| 324 | 324 | ** See also: [sqlite3_libversion()], |
| 325 | 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | 327 | */ |
| 328 | -#define SQLITE_VERSION "3.9.1" | |
| 329 | -#define SQLITE_VERSION_NUMBER 3009001 | |
| 330 | -#define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02" | |
| 328 | +#define SQLITE_VERSION "3.9.2" | |
| 329 | +#define SQLITE_VERSION_NUMBER 3009002 | |
| 330 | +#define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328" | |
| 331 | 331 | |
| 332 | 332 | /* |
| 333 | 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | 335 | ** |
| @@ -94032,10 +94032,34 @@ | ||
| 94032 | 94032 | (int)(pSpan->zEnd - pSpan->zStart)); |
| 94033 | 94033 | } |
| 94034 | 94034 | } |
| 94035 | 94035 | sqlite3ExprDelete(db, pSpan->pExpr); |
| 94036 | 94036 | } |
| 94037 | + | |
| 94038 | +/* | |
| 94039 | +** Backwards Compatibility Hack: | |
| 94040 | +** | |
| 94041 | +** Historical versions of SQLite accepted strings as column names in | |
| 94042 | +** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: | |
| 94043 | +** | |
| 94044 | +** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) | |
| 94045 | +** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); | |
| 94046 | +** | |
| 94047 | +** This is goofy. But to preserve backwards compatibility we continue to | |
| 94048 | +** accept it. This routine does the necessary conversion. It converts | |
| 94049 | +** the expression given in its argument from a TK_STRING into a TK_ID | |
| 94050 | +** if the expression is just a TK_STRING with an optional COLLATE clause. | |
| 94051 | +** If the epxression is anything other than TK_STRING, the expression is | |
| 94052 | +** unchanged. | |
| 94053 | +*/ | |
| 94054 | +static void sqlite3StringToId(Expr *p){ | |
| 94055 | + if( p->op==TK_STRING ){ | |
| 94056 | + p->op = TK_ID; | |
| 94057 | + }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ | |
| 94058 | + p->pLeft->op = TK_ID; | |
| 94059 | + } | |
| 94060 | +} | |
| 94037 | 94061 | |
| 94038 | 94062 | /* |
| 94039 | 94063 | ** Designate the PRIMARY KEY for the table. pList is a list of names |
| 94040 | 94064 | ** of columns that form the primary key. If pList is NULL, then the |
| 94041 | 94065 | ** most recently added column of the table is the primary key. |
| @@ -94079,10 +94103,11 @@ | ||
| 94079 | 94103 | }else{ |
| 94080 | 94104 | nTerm = pList->nExpr; |
| 94081 | 94105 | for(i=0; i<nTerm; i++){ |
| 94082 | 94106 | Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr); |
| 94083 | 94107 | assert( pCExpr!=0 ); |
| 94108 | + sqlite3StringToId(pCExpr); | |
| 94084 | 94109 | if( pCExpr->op==TK_ID ){ |
| 94085 | 94110 | const char *zCName = pCExpr->u.zToken; |
| 94086 | 94111 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 94087 | 94112 | if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ |
| 94088 | 94113 | pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; |
| @@ -95617,34 +95642,10 @@ | ||
| 95617 | 95642 | *ppExtra = ((char*)p) + nByte; |
| 95618 | 95643 | } |
| 95619 | 95644 | return p; |
| 95620 | 95645 | } |
| 95621 | 95646 | |
| 95622 | -/* | |
| 95623 | -** Backwards Compatibility Hack: | |
| 95624 | -** | |
| 95625 | -** Historical versions of SQLite accepted strings as column names in | |
| 95626 | -** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: | |
| 95627 | -** | |
| 95628 | -** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) | |
| 95629 | -** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); | |
| 95630 | -** | |
| 95631 | -** This is goofy. But to preserve backwards compatibility we continue to | |
| 95632 | -** accept it. This routine does the necessary conversion. It converts | |
| 95633 | -** the expression given in its argument from a TK_STRING into a TK_ID | |
| 95634 | -** if the expression is just a TK_STRING with an optional COLLATE clause. | |
| 95635 | -** If the epxression is anything other than TK_STRING, the expression is | |
| 95636 | -** unchanged. | |
| 95637 | -*/ | |
| 95638 | -static void sqlite3StringToId(Expr *p){ | |
| 95639 | - if( p->op==TK_STRING ){ | |
| 95640 | - p->op = TK_ID; | |
| 95641 | - }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ | |
| 95642 | - p->pLeft->op = TK_ID; | |
| 95643 | - } | |
| 95644 | -} | |
| 95645 | - | |
| 95646 | 95647 | /* |
| 95647 | 95648 | ** Create a new index for an SQL table. pName1.pName2 is the name of the index |
| 95648 | 95649 | ** and pTblList is the name of the table that is to be indexed. Both will |
| 95649 | 95650 | ** be NULL for a primary key or an index that is created to satisfy a |
| 95650 | 95651 | ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable |
| @@ -121856,18 +121857,24 @@ | ||
| 121856 | 121857 | |
| 121857 | 121858 | /* |
| 121858 | 121859 | ** Convert OP_Column opcodes to OP_Copy in previously generated code. |
| 121859 | 121860 | ** |
| 121860 | 121861 | ** This routine runs over generated VDBE code and translates OP_Column |
| 121861 | -** opcodes into OP_Copy, and OP_Rowid into OP_Null, when the table is being | |
| 121862 | -** accessed via co-routine instead of via table lookup. | |
| 121862 | +** opcodes into OP_Copy when the table is being accessed via co-routine | |
| 121863 | +** instead of via table lookup. | |
| 121864 | +** | |
| 121865 | +** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on | |
| 121866 | +** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero, | |
| 121867 | +** then each OP_Rowid is transformed into an instruction to increment the | |
| 121868 | +** value stored in its output register. | |
| 121863 | 121869 | */ |
| 121864 | 121870 | static void translateColumnToCopy( |
| 121865 | 121871 | Vdbe *v, /* The VDBE containing code to translate */ |
| 121866 | 121872 | int iStart, /* Translate from this opcode to the end */ |
| 121867 | 121873 | int iTabCur, /* OP_Column/OP_Rowid references to this table */ |
| 121868 | - int iRegister /* The first column is in this register */ | |
| 121874 | + int iRegister, /* The first column is in this register */ | |
| 121875 | + int bIncrRowid /* If non-zero, transform OP_rowid to OP_AddImm(1) */ | |
| 121869 | 121876 | ){ |
| 121870 | 121877 | VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart); |
| 121871 | 121878 | int iEnd = sqlite3VdbeCurrentAddr(v); |
| 121872 | 121879 | for(; iStart<iEnd; iStart++, pOp++){ |
| 121873 | 121880 | if( pOp->p1!=iTabCur ) continue; |
| @@ -121875,13 +121882,20 @@ | ||
| 121875 | 121882 | pOp->opcode = OP_Copy; |
| 121876 | 121883 | pOp->p1 = pOp->p2 + iRegister; |
| 121877 | 121884 | pOp->p2 = pOp->p3; |
| 121878 | 121885 | pOp->p3 = 0; |
| 121879 | 121886 | }else if( pOp->opcode==OP_Rowid ){ |
| 121880 | - pOp->opcode = OP_Null; | |
| 121881 | - pOp->p1 = 0; | |
| 121882 | - pOp->p3 = 0; | |
| 121887 | + if( bIncrRowid ){ | |
| 121888 | + /* Increment the value stored in the P2 operand of the OP_Rowid. */ | |
| 121889 | + pOp->opcode = OP_AddImm; | |
| 121890 | + pOp->p1 = pOp->p2; | |
| 121891 | + pOp->p2 = 1; | |
| 121892 | + }else{ | |
| 121893 | + pOp->opcode = OP_Null; | |
| 121894 | + pOp->p1 = 0; | |
| 121895 | + pOp->p3 = 0; | |
| 121896 | + } | |
| 121883 | 121897 | } |
| 121884 | 121898 | } |
| 121885 | 121899 | } |
| 121886 | 121900 | |
| 121887 | 121901 | /* |
| @@ -121985,10 +121999,12 @@ | ||
| 121985 | 121999 | Bitmask extraCols; /* Bitmap of additional columns */ |
| 121986 | 122000 | u8 sentWarning = 0; /* True if a warnning has been issued */ |
| 121987 | 122001 | Expr *pPartial = 0; /* Partial Index Expression */ |
| 121988 | 122002 | int iContinue = 0; /* Jump here to skip excluded rows */ |
| 121989 | 122003 | struct SrcList_item *pTabItem; /* FROM clause term being indexed */ |
| 122004 | + int addrCounter; /* Address where integer counter is initialized */ | |
| 122005 | + int regBase; /* Array of registers where record is assembled */ | |
| 121990 | 122006 | |
| 121991 | 122007 | /* Generate code to skip over the creation and initialization of the |
| 121992 | 122008 | ** transient index on 2nd and subsequent iterations of the loop. */ |
| 121993 | 122009 | v = pParse->pVdbe; |
| 121994 | 122010 | assert( v!=0 ); |
| @@ -122113,10 +122129,11 @@ | ||
| 122113 | 122129 | /* Fill the automatic index with content */ |
| 122114 | 122130 | sqlite3ExprCachePush(pParse); |
| 122115 | 122131 | pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; |
| 122116 | 122132 | if( pTabItem->fg.viaCoroutine ){ |
| 122117 | 122133 | int regYield = pTabItem->regReturn; |
| 122134 | + addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); | |
| 122118 | 122135 | sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); |
| 122119 | 122136 | addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); |
| 122120 | 122137 | VdbeCoverage(v); |
| 122121 | 122138 | VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName)); |
| 122122 | 122139 | }else{ |
| @@ -122126,16 +122143,19 @@ | ||
| 122126 | 122143 | iContinue = sqlite3VdbeMakeLabel(v); |
| 122127 | 122144 | sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); |
| 122128 | 122145 | pLoop->wsFlags |= WHERE_PARTIALIDX; |
| 122129 | 122146 | } |
| 122130 | 122147 | regRecord = sqlite3GetTempReg(pParse); |
| 122131 | - sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0); | |
| 122148 | + regBase = sqlite3GenerateIndexKey( | |
| 122149 | + pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 | |
| 122150 | + ); | |
| 122132 | 122151 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); |
| 122133 | 122152 | sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); |
| 122134 | 122153 | if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); |
| 122135 | 122154 | if( pTabItem->fg.viaCoroutine ){ |
| 122136 | - translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult); | |
| 122155 | + sqlite3VdbeChangeP2(v, addrCounter, regBase+n); | |
| 122156 | + translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult, 1); | |
| 122137 | 122157 | sqlite3VdbeGoto(v, addrTop); |
| 122138 | 122158 | pTabItem->fg.viaCoroutine = 0; |
| 122139 | 122159 | }else{ |
| 122140 | 122160 | sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); |
| 122141 | 122161 | } |
| @@ -125880,11 +125900,11 @@ | ||
| 125880 | 125900 | ** the co-routine into OP_Copy of result contained in a register. |
| 125881 | 125901 | ** OP_Rowid becomes OP_Null. |
| 125882 | 125902 | */ |
| 125883 | 125903 | if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){ |
| 125884 | 125904 | translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur, |
| 125885 | - pTabItem->regResult); | |
| 125905 | + pTabItem->regResult, 0); | |
| 125886 | 125906 | continue; |
| 125887 | 125907 | } |
| 125888 | 125908 | |
| 125889 | 125909 | /* Close all of the cursors that were opened by sqlite3WhereBegin. |
| 125890 | 125910 | ** Except, do not close cursors that will be reused by the OR optimization |
| @@ -180580,11 +180600,11 @@ | ||
| 180580 | 180600 | sqlite3_context *pCtx, /* Function call context */ |
| 180581 | 180601 | int nArg, /* Number of args */ |
| 180582 | 180602 | sqlite3_value **apVal /* Function arguments */ |
| 180583 | 180603 | ){ |
| 180584 | 180604 | assert( nArg==0 ); |
| 180585 | - sqlite3_result_text(pCtx, "fts5: 2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02", -1, SQLITE_TRANSIENT); | |
| 180605 | + sqlite3_result_text(pCtx, "fts5: 2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328", -1, SQLITE_TRANSIENT); | |
| 180586 | 180606 | } |
| 180587 | 180607 | |
| 180588 | 180608 | static int fts5Init(sqlite3 *db){ |
| 180589 | 180609 | static const sqlite3_module fts5Mod = { |
| 180590 | 180610 | /* iVersion */ 2, |
| 180591 | 180611 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.9.1. By combining all the individual C code files into this |
| 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 |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -323,13 +323,13 @@ | |
| 323 | ** |
| 324 | ** See also: [sqlite3_libversion()], |
| 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | */ |
| 328 | #define SQLITE_VERSION "3.9.1" |
| 329 | #define SQLITE_VERSION_NUMBER 3009001 |
| 330 | #define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02" |
| 331 | |
| 332 | /* |
| 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | ** |
| @@ -94032,10 +94032,34 @@ | |
| 94032 | (int)(pSpan->zEnd - pSpan->zStart)); |
| 94033 | } |
| 94034 | } |
| 94035 | sqlite3ExprDelete(db, pSpan->pExpr); |
| 94036 | } |
| 94037 | |
| 94038 | /* |
| 94039 | ** Designate the PRIMARY KEY for the table. pList is a list of names |
| 94040 | ** of columns that form the primary key. If pList is NULL, then the |
| 94041 | ** most recently added column of the table is the primary key. |
| @@ -94079,10 +94103,11 @@ | |
| 94079 | }else{ |
| 94080 | nTerm = pList->nExpr; |
| 94081 | for(i=0; i<nTerm; i++){ |
| 94082 | Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr); |
| 94083 | assert( pCExpr!=0 ); |
| 94084 | if( pCExpr->op==TK_ID ){ |
| 94085 | const char *zCName = pCExpr->u.zToken; |
| 94086 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 94087 | if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ |
| 94088 | pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; |
| @@ -95617,34 +95642,10 @@ | |
| 95617 | *ppExtra = ((char*)p) + nByte; |
| 95618 | } |
| 95619 | return p; |
| 95620 | } |
| 95621 | |
| 95622 | /* |
| 95623 | ** Backwards Compatibility Hack: |
| 95624 | ** |
| 95625 | ** Historical versions of SQLite accepted strings as column names in |
| 95626 | ** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: |
| 95627 | ** |
| 95628 | ** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) |
| 95629 | ** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); |
| 95630 | ** |
| 95631 | ** This is goofy. But to preserve backwards compatibility we continue to |
| 95632 | ** accept it. This routine does the necessary conversion. It converts |
| 95633 | ** the expression given in its argument from a TK_STRING into a TK_ID |
| 95634 | ** if the expression is just a TK_STRING with an optional COLLATE clause. |
| 95635 | ** If the epxression is anything other than TK_STRING, the expression is |
| 95636 | ** unchanged. |
| 95637 | */ |
| 95638 | static void sqlite3StringToId(Expr *p){ |
| 95639 | if( p->op==TK_STRING ){ |
| 95640 | p->op = TK_ID; |
| 95641 | }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ |
| 95642 | p->pLeft->op = TK_ID; |
| 95643 | } |
| 95644 | } |
| 95645 | |
| 95646 | /* |
| 95647 | ** Create a new index for an SQL table. pName1.pName2 is the name of the index |
| 95648 | ** and pTblList is the name of the table that is to be indexed. Both will |
| 95649 | ** be NULL for a primary key or an index that is created to satisfy a |
| 95650 | ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable |
| @@ -121856,18 +121857,24 @@ | |
| 121856 | |
| 121857 | /* |
| 121858 | ** Convert OP_Column opcodes to OP_Copy in previously generated code. |
| 121859 | ** |
| 121860 | ** This routine runs over generated VDBE code and translates OP_Column |
| 121861 | ** opcodes into OP_Copy, and OP_Rowid into OP_Null, when the table is being |
| 121862 | ** accessed via co-routine instead of via table lookup. |
| 121863 | */ |
| 121864 | static void translateColumnToCopy( |
| 121865 | Vdbe *v, /* The VDBE containing code to translate */ |
| 121866 | int iStart, /* Translate from this opcode to the end */ |
| 121867 | int iTabCur, /* OP_Column/OP_Rowid references to this table */ |
| 121868 | int iRegister /* The first column is in this register */ |
| 121869 | ){ |
| 121870 | VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart); |
| 121871 | int iEnd = sqlite3VdbeCurrentAddr(v); |
| 121872 | for(; iStart<iEnd; iStart++, pOp++){ |
| 121873 | if( pOp->p1!=iTabCur ) continue; |
| @@ -121875,13 +121882,20 @@ | |
| 121875 | pOp->opcode = OP_Copy; |
| 121876 | pOp->p1 = pOp->p2 + iRegister; |
| 121877 | pOp->p2 = pOp->p3; |
| 121878 | pOp->p3 = 0; |
| 121879 | }else if( pOp->opcode==OP_Rowid ){ |
| 121880 | pOp->opcode = OP_Null; |
| 121881 | pOp->p1 = 0; |
| 121882 | pOp->p3 = 0; |
| 121883 | } |
| 121884 | } |
| 121885 | } |
| 121886 | |
| 121887 | /* |
| @@ -121985,10 +121999,12 @@ | |
| 121985 | Bitmask extraCols; /* Bitmap of additional columns */ |
| 121986 | u8 sentWarning = 0; /* True if a warnning has been issued */ |
| 121987 | Expr *pPartial = 0; /* Partial Index Expression */ |
| 121988 | int iContinue = 0; /* Jump here to skip excluded rows */ |
| 121989 | struct SrcList_item *pTabItem; /* FROM clause term being indexed */ |
| 121990 | |
| 121991 | /* Generate code to skip over the creation and initialization of the |
| 121992 | ** transient index on 2nd and subsequent iterations of the loop. */ |
| 121993 | v = pParse->pVdbe; |
| 121994 | assert( v!=0 ); |
| @@ -122113,10 +122129,11 @@ | |
| 122113 | /* Fill the automatic index with content */ |
| 122114 | sqlite3ExprCachePush(pParse); |
| 122115 | pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; |
| 122116 | if( pTabItem->fg.viaCoroutine ){ |
| 122117 | int regYield = pTabItem->regReturn; |
| 122118 | sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); |
| 122119 | addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); |
| 122120 | VdbeCoverage(v); |
| 122121 | VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName)); |
| 122122 | }else{ |
| @@ -122126,16 +122143,19 @@ | |
| 122126 | iContinue = sqlite3VdbeMakeLabel(v); |
| 122127 | sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); |
| 122128 | pLoop->wsFlags |= WHERE_PARTIALIDX; |
| 122129 | } |
| 122130 | regRecord = sqlite3GetTempReg(pParse); |
| 122131 | sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0); |
| 122132 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); |
| 122133 | sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); |
| 122134 | if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); |
| 122135 | if( pTabItem->fg.viaCoroutine ){ |
| 122136 | translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult); |
| 122137 | sqlite3VdbeGoto(v, addrTop); |
| 122138 | pTabItem->fg.viaCoroutine = 0; |
| 122139 | }else{ |
| 122140 | sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); |
| 122141 | } |
| @@ -125880,11 +125900,11 @@ | |
| 125880 | ** the co-routine into OP_Copy of result contained in a register. |
| 125881 | ** OP_Rowid becomes OP_Null. |
| 125882 | */ |
| 125883 | if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){ |
| 125884 | translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur, |
| 125885 | pTabItem->regResult); |
| 125886 | continue; |
| 125887 | } |
| 125888 | |
| 125889 | /* Close all of the cursors that were opened by sqlite3WhereBegin. |
| 125890 | ** Except, do not close cursors that will be reused by the OR optimization |
| @@ -180580,11 +180600,11 @@ | |
| 180580 | sqlite3_context *pCtx, /* Function call context */ |
| 180581 | int nArg, /* Number of args */ |
| 180582 | sqlite3_value **apVal /* Function arguments */ |
| 180583 | ){ |
| 180584 | assert( nArg==0 ); |
| 180585 | sqlite3_result_text(pCtx, "fts5: 2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02", -1, SQLITE_TRANSIENT); |
| 180586 | } |
| 180587 | |
| 180588 | static int fts5Init(sqlite3 *db){ |
| 180589 | static const sqlite3_module fts5Mod = { |
| 180590 | /* iVersion */ 2, |
| 180591 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.9.2. By combining all the individual C code files into this |
| 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 |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -323,13 +323,13 @@ | |
| 323 | ** |
| 324 | ** See also: [sqlite3_libversion()], |
| 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | */ |
| 328 | #define SQLITE_VERSION "3.9.2" |
| 329 | #define SQLITE_VERSION_NUMBER 3009002 |
| 330 | #define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328" |
| 331 | |
| 332 | /* |
| 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | ** |
| @@ -94032,10 +94032,34 @@ | |
| 94032 | (int)(pSpan->zEnd - pSpan->zStart)); |
| 94033 | } |
| 94034 | } |
| 94035 | sqlite3ExprDelete(db, pSpan->pExpr); |
| 94036 | } |
| 94037 | |
| 94038 | /* |
| 94039 | ** Backwards Compatibility Hack: |
| 94040 | ** |
| 94041 | ** Historical versions of SQLite accepted strings as column names in |
| 94042 | ** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: |
| 94043 | ** |
| 94044 | ** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) |
| 94045 | ** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); |
| 94046 | ** |
| 94047 | ** This is goofy. But to preserve backwards compatibility we continue to |
| 94048 | ** accept it. This routine does the necessary conversion. It converts |
| 94049 | ** the expression given in its argument from a TK_STRING into a TK_ID |
| 94050 | ** if the expression is just a TK_STRING with an optional COLLATE clause. |
| 94051 | ** If the epxression is anything other than TK_STRING, the expression is |
| 94052 | ** unchanged. |
| 94053 | */ |
| 94054 | static void sqlite3StringToId(Expr *p){ |
| 94055 | if( p->op==TK_STRING ){ |
| 94056 | p->op = TK_ID; |
| 94057 | }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ |
| 94058 | p->pLeft->op = TK_ID; |
| 94059 | } |
| 94060 | } |
| 94061 | |
| 94062 | /* |
| 94063 | ** Designate the PRIMARY KEY for the table. pList is a list of names |
| 94064 | ** of columns that form the primary key. If pList is NULL, then the |
| 94065 | ** most recently added column of the table is the primary key. |
| @@ -94079,10 +94103,11 @@ | |
| 94103 | }else{ |
| 94104 | nTerm = pList->nExpr; |
| 94105 | for(i=0; i<nTerm; i++){ |
| 94106 | Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr); |
| 94107 | assert( pCExpr!=0 ); |
| 94108 | sqlite3StringToId(pCExpr); |
| 94109 | if( pCExpr->op==TK_ID ){ |
| 94110 | const char *zCName = pCExpr->u.zToken; |
| 94111 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 94112 | if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ |
| 94113 | pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; |
| @@ -95617,34 +95642,10 @@ | |
| 95642 | *ppExtra = ((char*)p) + nByte; |
| 95643 | } |
| 95644 | return p; |
| 95645 | } |
| 95646 | |
| 95647 | /* |
| 95648 | ** Create a new index for an SQL table. pName1.pName2 is the name of the index |
| 95649 | ** and pTblList is the name of the table that is to be indexed. Both will |
| 95650 | ** be NULL for a primary key or an index that is created to satisfy a |
| 95651 | ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable |
| @@ -121856,18 +121857,24 @@ | |
| 121857 | |
| 121858 | /* |
| 121859 | ** Convert OP_Column opcodes to OP_Copy in previously generated code. |
| 121860 | ** |
| 121861 | ** This routine runs over generated VDBE code and translates OP_Column |
| 121862 | ** opcodes into OP_Copy when the table is being accessed via co-routine |
| 121863 | ** instead of via table lookup. |
| 121864 | ** |
| 121865 | ** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on |
| 121866 | ** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero, |
| 121867 | ** then each OP_Rowid is transformed into an instruction to increment the |
| 121868 | ** value stored in its output register. |
| 121869 | */ |
| 121870 | static void translateColumnToCopy( |
| 121871 | Vdbe *v, /* The VDBE containing code to translate */ |
| 121872 | int iStart, /* Translate from this opcode to the end */ |
| 121873 | int iTabCur, /* OP_Column/OP_Rowid references to this table */ |
| 121874 | int iRegister, /* The first column is in this register */ |
| 121875 | int bIncrRowid /* If non-zero, transform OP_rowid to OP_AddImm(1) */ |
| 121876 | ){ |
| 121877 | VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart); |
| 121878 | int iEnd = sqlite3VdbeCurrentAddr(v); |
| 121879 | for(; iStart<iEnd; iStart++, pOp++){ |
| 121880 | if( pOp->p1!=iTabCur ) continue; |
| @@ -121875,13 +121882,20 @@ | |
| 121882 | pOp->opcode = OP_Copy; |
| 121883 | pOp->p1 = pOp->p2 + iRegister; |
| 121884 | pOp->p2 = pOp->p3; |
| 121885 | pOp->p3 = 0; |
| 121886 | }else if( pOp->opcode==OP_Rowid ){ |
| 121887 | if( bIncrRowid ){ |
| 121888 | /* Increment the value stored in the P2 operand of the OP_Rowid. */ |
| 121889 | pOp->opcode = OP_AddImm; |
| 121890 | pOp->p1 = pOp->p2; |
| 121891 | pOp->p2 = 1; |
| 121892 | }else{ |
| 121893 | pOp->opcode = OP_Null; |
| 121894 | pOp->p1 = 0; |
| 121895 | pOp->p3 = 0; |
| 121896 | } |
| 121897 | } |
| 121898 | } |
| 121899 | } |
| 121900 | |
| 121901 | /* |
| @@ -121985,10 +121999,12 @@ | |
| 121999 | Bitmask extraCols; /* Bitmap of additional columns */ |
| 122000 | u8 sentWarning = 0; /* True if a warnning has been issued */ |
| 122001 | Expr *pPartial = 0; /* Partial Index Expression */ |
| 122002 | int iContinue = 0; /* Jump here to skip excluded rows */ |
| 122003 | struct SrcList_item *pTabItem; /* FROM clause term being indexed */ |
| 122004 | int addrCounter; /* Address where integer counter is initialized */ |
| 122005 | int regBase; /* Array of registers where record is assembled */ |
| 122006 | |
| 122007 | /* Generate code to skip over the creation and initialization of the |
| 122008 | ** transient index on 2nd and subsequent iterations of the loop. */ |
| 122009 | v = pParse->pVdbe; |
| 122010 | assert( v!=0 ); |
| @@ -122113,10 +122129,11 @@ | |
| 122129 | /* Fill the automatic index with content */ |
| 122130 | sqlite3ExprCachePush(pParse); |
| 122131 | pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; |
| 122132 | if( pTabItem->fg.viaCoroutine ){ |
| 122133 | int regYield = pTabItem->regReturn; |
| 122134 | addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); |
| 122135 | sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); |
| 122136 | addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); |
| 122137 | VdbeCoverage(v); |
| 122138 | VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName)); |
| 122139 | }else{ |
| @@ -122126,16 +122143,19 @@ | |
| 122143 | iContinue = sqlite3VdbeMakeLabel(v); |
| 122144 | sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); |
| 122145 | pLoop->wsFlags |= WHERE_PARTIALIDX; |
| 122146 | } |
| 122147 | regRecord = sqlite3GetTempReg(pParse); |
| 122148 | regBase = sqlite3GenerateIndexKey( |
| 122149 | pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 |
| 122150 | ); |
| 122151 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); |
| 122152 | sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); |
| 122153 | if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); |
| 122154 | if( pTabItem->fg.viaCoroutine ){ |
| 122155 | sqlite3VdbeChangeP2(v, addrCounter, regBase+n); |
| 122156 | translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult, 1); |
| 122157 | sqlite3VdbeGoto(v, addrTop); |
| 122158 | pTabItem->fg.viaCoroutine = 0; |
| 122159 | }else{ |
| 122160 | sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); |
| 122161 | } |
| @@ -125880,11 +125900,11 @@ | |
| 125900 | ** the co-routine into OP_Copy of result contained in a register. |
| 125901 | ** OP_Rowid becomes OP_Null. |
| 125902 | */ |
| 125903 | if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){ |
| 125904 | translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur, |
| 125905 | pTabItem->regResult, 0); |
| 125906 | continue; |
| 125907 | } |
| 125908 | |
| 125909 | /* Close all of the cursors that were opened by sqlite3WhereBegin. |
| 125910 | ** Except, do not close cursors that will be reused by the OR optimization |
| @@ -180580,11 +180600,11 @@ | |
| 180600 | sqlite3_context *pCtx, /* Function call context */ |
| 180601 | int nArg, /* Number of args */ |
| 180602 | sqlite3_value **apVal /* Function arguments */ |
| 180603 | ){ |
| 180604 | assert( nArg==0 ); |
| 180605 | sqlite3_result_text(pCtx, "fts5: 2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328", -1, SQLITE_TRANSIENT); |
| 180606 | } |
| 180607 | |
| 180608 | static int fts5Init(sqlite3 *db){ |
| 180609 | static const sqlite3_module fts5Mod = { |
| 180610 | /* iVersion */ 2, |
| 180611 |
+3
-3
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -109,13 +109,13 @@ | ||
| 109 | 109 | ** |
| 110 | 110 | ** See also: [sqlite3_libversion()], |
| 111 | 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | 113 | */ |
| 114 | -#define SQLITE_VERSION "3.9.1" | |
| 115 | -#define SQLITE_VERSION_NUMBER 3009001 | |
| 116 | -#define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02" | |
| 114 | +#define SQLITE_VERSION "3.9.2" | |
| 115 | +#define SQLITE_VERSION_NUMBER 3009002 | |
| 116 | +#define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328" | |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | 121 | ** |
| 122 | 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -109,13 +109,13 @@ | |
| 109 | ** |
| 110 | ** See also: [sqlite3_libversion()], |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.9.1" |
| 115 | #define SQLITE_VERSION_NUMBER 3009001 |
| 116 | #define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -109,13 +109,13 @@ | |
| 109 | ** |
| 110 | ** See also: [sqlite3_libversion()], |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.9.2" |
| 115 | #define SQLITE_VERSION_NUMBER 3009002 |
| 116 | #define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |