Fossil SCM
Update the built-in SQLite to the third 3.18.0 beta.
Commit
af225fea67f141901695aac15d0857514a7613476c3b1b5b9207f5ff1ff79572
Parent
131bef423401fb1…
2 files changed
+58
-17
+1
-1
+58
-17
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -398,11 +398,11 @@ | ||
| 398 | 398 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 399 | 399 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 400 | 400 | */ |
| 401 | 401 | #define SQLITE_VERSION "3.18.0" |
| 402 | 402 | #define SQLITE_VERSION_NUMBER 3018000 |
| 403 | -#define SQLITE_SOURCE_ID "2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc" | |
| 403 | +#define SQLITE_SOURCE_ID "2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4" | |
| 404 | 404 | |
| 405 | 405 | /* |
| 406 | 406 | ** CAPI3REF: Run-Time Library Version Numbers |
| 407 | 407 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 408 | 408 | ** |
| @@ -12645,10 +12645,11 @@ | ||
| 12645 | 12645 | struct SubProgram { |
| 12646 | 12646 | VdbeOp *aOp; /* Array of opcodes for sub-program */ |
| 12647 | 12647 | int nOp; /* Elements in aOp[] */ |
| 12648 | 12648 | int nMem; /* Number of memory cells required */ |
| 12649 | 12649 | int nCsr; /* Number of cursors required */ |
| 12650 | + u8 *aOnce; /* Array of OP_Once flags */ | |
| 12650 | 12651 | void *token; /* id that may be used to recursive triggers */ |
| 12651 | 12652 | SubProgram *pNext; /* Next sub-program already visited */ |
| 12652 | 12653 | }; |
| 12653 | 12654 | |
| 12654 | 12655 | /* |
| @@ -18070,10 +18071,11 @@ | ||
| 18070 | 18071 | VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */ |
| 18071 | 18072 | Op *aOp; /* Program instructions for parent frame */ |
| 18072 | 18073 | i64 *anExec; /* Event counters from parent frame */ |
| 18073 | 18074 | Mem *aMem; /* Array of memory cells for parent frame */ |
| 18074 | 18075 | VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */ |
| 18076 | + u8 *aOnce; /* Bitmask used by OP_Once */ | |
| 18075 | 18077 | void *token; /* Copy of SubProgram.token */ |
| 18076 | 18078 | i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */ |
| 18077 | 18079 | AuxData *pAuxData; /* Linked list of auxdata allocations */ |
| 18078 | 18080 | int nCursor; /* Number of entries in apCsr */ |
| 18079 | 18081 | int pc; /* Program Counter in parent (calling) frame */ |
| @@ -80512,23 +80514,43 @@ | ||
| 80512 | 80514 | break; |
| 80513 | 80515 | } |
| 80514 | 80516 | |
| 80515 | 80517 | /* Opcode: Once P1 P2 * * * |
| 80516 | 80518 | ** |
| 80517 | -** If the P1 value is equal to the P1 value on the OP_Init opcode at | |
| 80518 | -** instruction 0, then jump to P2. If the two P1 values differ, then | |
| 80519 | -** set the P1 value on this opcode to equal the P1 value on the OP_Init | |
| 80520 | -** and fall through. | |
| 80519 | +** Fall through to the next instruction the first time this opcode is | |
| 80520 | +** encountered on each invocation of the byte-code program. Jump to P2 | |
| 80521 | +** on the second and all subsequent encounters during the same invocation. | |
| 80522 | +** | |
| 80523 | +** Top-level programs determine first invocation by comparing the P1 | |
| 80524 | +** operand against the P1 operand on the OP_Init opcode at the beginning | |
| 80525 | +** of the program. If the P1 values differ, then fall through and make | |
| 80526 | +** the P1 of this opcode equal to the P1 of OP_Init. If P1 values are | |
| 80527 | +** the same then take the jump. | |
| 80528 | +** | |
| 80529 | +** For subprograms, there is a bitmask in the VdbeFrame that determines | |
| 80530 | +** whether or not the jump should be taken. The bitmask is necessary | |
| 80531 | +** because the self-altering code trick does not work for recursive | |
| 80532 | +** triggers. | |
| 80521 | 80533 | */ |
| 80522 | 80534 | case OP_Once: { /* jump */ |
| 80535 | + u32 iAddr; /* Address of this instruction */ | |
| 80523 | 80536 | assert( p->aOp[0].opcode==OP_Init ); |
| 80524 | - VdbeBranchTaken(p->aOp[0].p1==pOp->p1, 2); | |
| 80525 | - if( p->aOp[0].p1==pOp->p1 ){ | |
| 80526 | - goto jump_to_p2; | |
| 80537 | + if( p->pFrame ){ | |
| 80538 | + iAddr = (int)(pOp - p->aOp); | |
| 80539 | + if( (p->pFrame->aOnce[iAddr/8] & (1<<(iAddr & 7)))!=0 ){ | |
| 80540 | + VdbeBranchTaken(1, 2); | |
| 80541 | + goto jump_to_p2; | |
| 80542 | + } | |
| 80543 | + p->pFrame->aOnce[iAddr/8] |= 1<<(iAddr & 7); | |
| 80527 | 80544 | }else{ |
| 80528 | - pOp->p1 = p->aOp[0].p1; | |
| 80545 | + if( p->aOp[0].p1==pOp->p1 ){ | |
| 80546 | + VdbeBranchTaken(1, 2); | |
| 80547 | + goto jump_to_p2; | |
| 80548 | + } | |
| 80529 | 80549 | } |
| 80550 | + VdbeBranchTaken(0, 2); | |
| 80551 | + pOp->p1 = p->aOp[0].p1; | |
| 80530 | 80552 | break; |
| 80531 | 80553 | } |
| 80532 | 80554 | |
| 80533 | 80555 | /* Opcode: If P1 P2 P3 * * |
| 80534 | 80556 | ** |
| @@ -84050,11 +84072,12 @@ | ||
| 84050 | 84072 | nMem = pProgram->nMem + pProgram->nCsr; |
| 84051 | 84073 | assert( nMem>0 ); |
| 84052 | 84074 | if( pProgram->nCsr==0 ) nMem++; |
| 84053 | 84075 | nByte = ROUND8(sizeof(VdbeFrame)) |
| 84054 | 84076 | + nMem * sizeof(Mem) |
| 84055 | - + pProgram->nCsr * sizeof(VdbeCursor *); | |
| 84077 | + + pProgram->nCsr * sizeof(VdbeCursor*) | |
| 84078 | + + (pProgram->nOp + 7)/8; | |
| 84056 | 84079 | pFrame = sqlite3DbMallocZero(db, nByte); |
| 84057 | 84080 | if( !pFrame ){ |
| 84058 | 84081 | goto no_mem; |
| 84059 | 84082 | } |
| 84060 | 84083 | sqlite3VdbeMemRelease(pRt); |
| @@ -84101,10 +84124,12 @@ | ||
| 84101 | 84124 | p->pFrame = pFrame; |
| 84102 | 84125 | p->aMem = aMem = VdbeFrameMem(pFrame); |
| 84103 | 84126 | p->nMem = pFrame->nChildMem; |
| 84104 | 84127 | p->nCursor = (u16)pFrame->nChildCsr; |
| 84105 | 84128 | p->apCsr = (VdbeCursor **)&aMem[p->nMem]; |
| 84129 | + pFrame->aOnce = (u8*)&p->apCsr[pProgram->nCsr]; | |
| 84130 | + memset(pFrame->aOnce, 0, (pProgram->nOp + 7)/8); | |
| 84106 | 84131 | p->aOp = aOp = pProgram->aOp; |
| 84107 | 84132 | p->nOp = pProgram->nOp; |
| 84108 | 84133 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 84109 | 84134 | p->anExec = 0; |
| 84110 | 84135 | #endif |
| @@ -179948,10 +179973,29 @@ | ||
| 179948 | 179973 | zFuncName); |
| 179949 | 179974 | sqlite3_result_error(pCtx, zMsg, -1); |
| 179950 | 179975 | sqlite3_free(zMsg); |
| 179951 | 179976 | } |
| 179952 | 179977 | |
| 179978 | +/* | |
| 179979 | +** Mark all NULL entries in the Object passed in as JNODE_REMOVE. | |
| 179980 | +*/ | |
| 179981 | +static void jsonRemoveAllNulls(JsonNode *pNode){ | |
| 179982 | + int i, n; | |
| 179983 | + assert( pNode->eType==JSON_OBJECT ); | |
| 179984 | + n = pNode->n; | |
| 179985 | + for(i=2; i<=n; i += jsonNodeSize(&pNode[i])+1){ | |
| 179986 | + switch( pNode[i].eType ){ | |
| 179987 | + case JSON_NULL: | |
| 179988 | + pNode[i].jnFlags |= JNODE_REMOVE; | |
| 179989 | + break; | |
| 179990 | + case JSON_OBJECT: | |
| 179991 | + jsonRemoveAllNulls(&pNode[i]); | |
| 179992 | + break; | |
| 179993 | + } | |
| 179994 | + } | |
| 179995 | +} | |
| 179996 | + | |
| 179953 | 179997 | |
| 179954 | 179998 | /**************************************************************************** |
| 179955 | 179999 | ** SQL functions used for testing and debugging |
| 179956 | 180000 | ****************************************************************************/ |
| 179957 | 180001 | |
| @@ -180157,20 +180201,16 @@ | ||
| 180157 | 180201 | } |
| 180158 | 180202 | assert( iTarget>=0 && iTarget<pParse->nNode ); |
| 180159 | 180203 | pTarget = &pParse->aNode[iTarget]; |
| 180160 | 180204 | assert( (pPatch->jnFlags & JNODE_APPEND)==0 ); |
| 180161 | 180205 | if( pTarget->eType!=JSON_OBJECT ){ |
| 180162 | - for(i=2; i<=pPatch->n; i += jsonNodeSize(&pPatch[i])+1){ | |
| 180163 | - if( pPatch[i].eType==JSON_NULL ){ | |
| 180164 | - pPatch[i].jnFlags |= JNODE_REMOVE; | |
| 180165 | - } | |
| 180166 | - } | |
| 180206 | + jsonRemoveAllNulls(pPatch); | |
| 180167 | 180207 | return pPatch; |
| 180168 | 180208 | } |
| 180169 | 180209 | iRoot = iTarget; |
| 180170 | 180210 | for(i=1; i<pPatch->n; i += jsonNodeSize(&pPatch[i+1])+1){ |
| 180171 | - int nKey; | |
| 180211 | + u32 nKey; | |
| 180172 | 180212 | const char *zKey; |
| 180173 | 180213 | assert( pPatch[i].eType==JSON_STRING ); |
| 180174 | 180214 | assert( pPatch[i].jnFlags & JNODE_LABEL ); |
| 180175 | 180215 | nKey = pPatch[i].n; |
| 180176 | 180216 | zKey = pPatch[i].u.zJContent; |
| @@ -180199,10 +180239,11 @@ | ||
| 180199 | 180239 | int iStart, iPatch; |
| 180200 | 180240 | iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); |
| 180201 | 180241 | jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); |
| 180202 | 180242 | iPatch = jsonParseAddNode(pParse, JSON_TRUE, 0, 0); |
| 180203 | 180243 | if( pParse->oom ) return 0; |
| 180244 | + jsonRemoveAllNulls(pPatch); | |
| 180204 | 180245 | pTarget = &pParse->aNode[iTarget]; |
| 180205 | 180246 | pParse->aNode[iRoot].jnFlags |= JNODE_APPEND; |
| 180206 | 180247 | pParse->aNode[iRoot].u.iAppend = iStart - iRoot; |
| 180207 | 180248 | iRoot = iStart; |
| 180208 | 180249 | pParse->aNode[iPatch].jnFlags |= JNODE_PATCH; |
| @@ -198207,11 +198248,11 @@ | ||
| 198207 | 198248 | int nArg, /* Number of args */ |
| 198208 | 198249 | sqlite3_value **apUnused /* Function arguments */ |
| 198209 | 198250 | ){ |
| 198210 | 198251 | assert( nArg==0 ); |
| 198211 | 198252 | UNUSED_PARAM2(nArg, apUnused); |
| 198212 | - sqlite3_result_text(pCtx, "fts5: 2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc", -1, SQLITE_TRANSIENT); | |
| 198253 | + sqlite3_result_text(pCtx, "fts5: 2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4", -1, SQLITE_TRANSIENT); | |
| 198213 | 198254 | } |
| 198214 | 198255 | |
| 198215 | 198256 | static int fts5Init(sqlite3 *db){ |
| 198216 | 198257 | static const sqlite3_module fts5Mod = { |
| 198217 | 198258 | /* iVersion */ 2, |
| 198218 | 198259 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -398,11 +398,11 @@ | |
| 398 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 399 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 400 | */ |
| 401 | #define SQLITE_VERSION "3.18.0" |
| 402 | #define SQLITE_VERSION_NUMBER 3018000 |
| 403 | #define SQLITE_SOURCE_ID "2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc" |
| 404 | |
| 405 | /* |
| 406 | ** CAPI3REF: Run-Time Library Version Numbers |
| 407 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 408 | ** |
| @@ -12645,10 +12645,11 @@ | |
| 12645 | struct SubProgram { |
| 12646 | VdbeOp *aOp; /* Array of opcodes for sub-program */ |
| 12647 | int nOp; /* Elements in aOp[] */ |
| 12648 | int nMem; /* Number of memory cells required */ |
| 12649 | int nCsr; /* Number of cursors required */ |
| 12650 | void *token; /* id that may be used to recursive triggers */ |
| 12651 | SubProgram *pNext; /* Next sub-program already visited */ |
| 12652 | }; |
| 12653 | |
| 12654 | /* |
| @@ -18070,10 +18071,11 @@ | |
| 18070 | VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */ |
| 18071 | Op *aOp; /* Program instructions for parent frame */ |
| 18072 | i64 *anExec; /* Event counters from parent frame */ |
| 18073 | Mem *aMem; /* Array of memory cells for parent frame */ |
| 18074 | VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */ |
| 18075 | void *token; /* Copy of SubProgram.token */ |
| 18076 | i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */ |
| 18077 | AuxData *pAuxData; /* Linked list of auxdata allocations */ |
| 18078 | int nCursor; /* Number of entries in apCsr */ |
| 18079 | int pc; /* Program Counter in parent (calling) frame */ |
| @@ -80512,23 +80514,43 @@ | |
| 80512 | break; |
| 80513 | } |
| 80514 | |
| 80515 | /* Opcode: Once P1 P2 * * * |
| 80516 | ** |
| 80517 | ** If the P1 value is equal to the P1 value on the OP_Init opcode at |
| 80518 | ** instruction 0, then jump to P2. If the two P1 values differ, then |
| 80519 | ** set the P1 value on this opcode to equal the P1 value on the OP_Init |
| 80520 | ** and fall through. |
| 80521 | */ |
| 80522 | case OP_Once: { /* jump */ |
| 80523 | assert( p->aOp[0].opcode==OP_Init ); |
| 80524 | VdbeBranchTaken(p->aOp[0].p1==pOp->p1, 2); |
| 80525 | if( p->aOp[0].p1==pOp->p1 ){ |
| 80526 | goto jump_to_p2; |
| 80527 | }else{ |
| 80528 | pOp->p1 = p->aOp[0].p1; |
| 80529 | } |
| 80530 | break; |
| 80531 | } |
| 80532 | |
| 80533 | /* Opcode: If P1 P2 P3 * * |
| 80534 | ** |
| @@ -84050,11 +84072,12 @@ | |
| 84050 | nMem = pProgram->nMem + pProgram->nCsr; |
| 84051 | assert( nMem>0 ); |
| 84052 | if( pProgram->nCsr==0 ) nMem++; |
| 84053 | nByte = ROUND8(sizeof(VdbeFrame)) |
| 84054 | + nMem * sizeof(Mem) |
| 84055 | + pProgram->nCsr * sizeof(VdbeCursor *); |
| 84056 | pFrame = sqlite3DbMallocZero(db, nByte); |
| 84057 | if( !pFrame ){ |
| 84058 | goto no_mem; |
| 84059 | } |
| 84060 | sqlite3VdbeMemRelease(pRt); |
| @@ -84101,10 +84124,12 @@ | |
| 84101 | p->pFrame = pFrame; |
| 84102 | p->aMem = aMem = VdbeFrameMem(pFrame); |
| 84103 | p->nMem = pFrame->nChildMem; |
| 84104 | p->nCursor = (u16)pFrame->nChildCsr; |
| 84105 | p->apCsr = (VdbeCursor **)&aMem[p->nMem]; |
| 84106 | p->aOp = aOp = pProgram->aOp; |
| 84107 | p->nOp = pProgram->nOp; |
| 84108 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 84109 | p->anExec = 0; |
| 84110 | #endif |
| @@ -179948,10 +179973,29 @@ | |
| 179948 | zFuncName); |
| 179949 | sqlite3_result_error(pCtx, zMsg, -1); |
| 179950 | sqlite3_free(zMsg); |
| 179951 | } |
| 179952 | |
| 179953 | |
| 179954 | /**************************************************************************** |
| 179955 | ** SQL functions used for testing and debugging |
| 179956 | ****************************************************************************/ |
| 179957 | |
| @@ -180157,20 +180201,16 @@ | |
| 180157 | } |
| 180158 | assert( iTarget>=0 && iTarget<pParse->nNode ); |
| 180159 | pTarget = &pParse->aNode[iTarget]; |
| 180160 | assert( (pPatch->jnFlags & JNODE_APPEND)==0 ); |
| 180161 | if( pTarget->eType!=JSON_OBJECT ){ |
| 180162 | for(i=2; i<=pPatch->n; i += jsonNodeSize(&pPatch[i])+1){ |
| 180163 | if( pPatch[i].eType==JSON_NULL ){ |
| 180164 | pPatch[i].jnFlags |= JNODE_REMOVE; |
| 180165 | } |
| 180166 | } |
| 180167 | return pPatch; |
| 180168 | } |
| 180169 | iRoot = iTarget; |
| 180170 | for(i=1; i<pPatch->n; i += jsonNodeSize(&pPatch[i+1])+1){ |
| 180171 | int nKey; |
| 180172 | const char *zKey; |
| 180173 | assert( pPatch[i].eType==JSON_STRING ); |
| 180174 | assert( pPatch[i].jnFlags & JNODE_LABEL ); |
| 180175 | nKey = pPatch[i].n; |
| 180176 | zKey = pPatch[i].u.zJContent; |
| @@ -180199,10 +180239,11 @@ | |
| 180199 | int iStart, iPatch; |
| 180200 | iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); |
| 180201 | jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); |
| 180202 | iPatch = jsonParseAddNode(pParse, JSON_TRUE, 0, 0); |
| 180203 | if( pParse->oom ) return 0; |
| 180204 | pTarget = &pParse->aNode[iTarget]; |
| 180205 | pParse->aNode[iRoot].jnFlags |= JNODE_APPEND; |
| 180206 | pParse->aNode[iRoot].u.iAppend = iStart - iRoot; |
| 180207 | iRoot = iStart; |
| 180208 | pParse->aNode[iPatch].jnFlags |= JNODE_PATCH; |
| @@ -198207,11 +198248,11 @@ | |
| 198207 | int nArg, /* Number of args */ |
| 198208 | sqlite3_value **apUnused /* Function arguments */ |
| 198209 | ){ |
| 198210 | assert( nArg==0 ); |
| 198211 | UNUSED_PARAM2(nArg, apUnused); |
| 198212 | sqlite3_result_text(pCtx, "fts5: 2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc", -1, SQLITE_TRANSIENT); |
| 198213 | } |
| 198214 | |
| 198215 | static int fts5Init(sqlite3 *db){ |
| 198216 | static const sqlite3_module fts5Mod = { |
| 198217 | /* iVersion */ 2, |
| 198218 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -398,11 +398,11 @@ | |
| 398 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 399 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 400 | */ |
| 401 | #define SQLITE_VERSION "3.18.0" |
| 402 | #define SQLITE_VERSION_NUMBER 3018000 |
| 403 | #define SQLITE_SOURCE_ID "2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4" |
| 404 | |
| 405 | /* |
| 406 | ** CAPI3REF: Run-Time Library Version Numbers |
| 407 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 408 | ** |
| @@ -12645,10 +12645,11 @@ | |
| 12645 | struct SubProgram { |
| 12646 | VdbeOp *aOp; /* Array of opcodes for sub-program */ |
| 12647 | int nOp; /* Elements in aOp[] */ |
| 12648 | int nMem; /* Number of memory cells required */ |
| 12649 | int nCsr; /* Number of cursors required */ |
| 12650 | u8 *aOnce; /* Array of OP_Once flags */ |
| 12651 | void *token; /* id that may be used to recursive triggers */ |
| 12652 | SubProgram *pNext; /* Next sub-program already visited */ |
| 12653 | }; |
| 12654 | |
| 12655 | /* |
| @@ -18070,10 +18071,11 @@ | |
| 18071 | VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */ |
| 18072 | Op *aOp; /* Program instructions for parent frame */ |
| 18073 | i64 *anExec; /* Event counters from parent frame */ |
| 18074 | Mem *aMem; /* Array of memory cells for parent frame */ |
| 18075 | VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */ |
| 18076 | u8 *aOnce; /* Bitmask used by OP_Once */ |
| 18077 | void *token; /* Copy of SubProgram.token */ |
| 18078 | i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */ |
| 18079 | AuxData *pAuxData; /* Linked list of auxdata allocations */ |
| 18080 | int nCursor; /* Number of entries in apCsr */ |
| 18081 | int pc; /* Program Counter in parent (calling) frame */ |
| @@ -80512,23 +80514,43 @@ | |
| 80514 | break; |
| 80515 | } |
| 80516 | |
| 80517 | /* Opcode: Once P1 P2 * * * |
| 80518 | ** |
| 80519 | ** Fall through to the next instruction the first time this opcode is |
| 80520 | ** encountered on each invocation of the byte-code program. Jump to P2 |
| 80521 | ** on the second and all subsequent encounters during the same invocation. |
| 80522 | ** |
| 80523 | ** Top-level programs determine first invocation by comparing the P1 |
| 80524 | ** operand against the P1 operand on the OP_Init opcode at the beginning |
| 80525 | ** of the program. If the P1 values differ, then fall through and make |
| 80526 | ** the P1 of this opcode equal to the P1 of OP_Init. If P1 values are |
| 80527 | ** the same then take the jump. |
| 80528 | ** |
| 80529 | ** For subprograms, there is a bitmask in the VdbeFrame that determines |
| 80530 | ** whether or not the jump should be taken. The bitmask is necessary |
| 80531 | ** because the self-altering code trick does not work for recursive |
| 80532 | ** triggers. |
| 80533 | */ |
| 80534 | case OP_Once: { /* jump */ |
| 80535 | u32 iAddr; /* Address of this instruction */ |
| 80536 | assert( p->aOp[0].opcode==OP_Init ); |
| 80537 | if( p->pFrame ){ |
| 80538 | iAddr = (int)(pOp - p->aOp); |
| 80539 | if( (p->pFrame->aOnce[iAddr/8] & (1<<(iAddr & 7)))!=0 ){ |
| 80540 | VdbeBranchTaken(1, 2); |
| 80541 | goto jump_to_p2; |
| 80542 | } |
| 80543 | p->pFrame->aOnce[iAddr/8] |= 1<<(iAddr & 7); |
| 80544 | }else{ |
| 80545 | if( p->aOp[0].p1==pOp->p1 ){ |
| 80546 | VdbeBranchTaken(1, 2); |
| 80547 | goto jump_to_p2; |
| 80548 | } |
| 80549 | } |
| 80550 | VdbeBranchTaken(0, 2); |
| 80551 | pOp->p1 = p->aOp[0].p1; |
| 80552 | break; |
| 80553 | } |
| 80554 | |
| 80555 | /* Opcode: If P1 P2 P3 * * |
| 80556 | ** |
| @@ -84050,11 +84072,12 @@ | |
| 84072 | nMem = pProgram->nMem + pProgram->nCsr; |
| 84073 | assert( nMem>0 ); |
| 84074 | if( pProgram->nCsr==0 ) nMem++; |
| 84075 | nByte = ROUND8(sizeof(VdbeFrame)) |
| 84076 | + nMem * sizeof(Mem) |
| 84077 | + pProgram->nCsr * sizeof(VdbeCursor*) |
| 84078 | + (pProgram->nOp + 7)/8; |
| 84079 | pFrame = sqlite3DbMallocZero(db, nByte); |
| 84080 | if( !pFrame ){ |
| 84081 | goto no_mem; |
| 84082 | } |
| 84083 | sqlite3VdbeMemRelease(pRt); |
| @@ -84101,10 +84124,12 @@ | |
| 84124 | p->pFrame = pFrame; |
| 84125 | p->aMem = aMem = VdbeFrameMem(pFrame); |
| 84126 | p->nMem = pFrame->nChildMem; |
| 84127 | p->nCursor = (u16)pFrame->nChildCsr; |
| 84128 | p->apCsr = (VdbeCursor **)&aMem[p->nMem]; |
| 84129 | pFrame->aOnce = (u8*)&p->apCsr[pProgram->nCsr]; |
| 84130 | memset(pFrame->aOnce, 0, (pProgram->nOp + 7)/8); |
| 84131 | p->aOp = aOp = pProgram->aOp; |
| 84132 | p->nOp = pProgram->nOp; |
| 84133 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 84134 | p->anExec = 0; |
| 84135 | #endif |
| @@ -179948,10 +179973,29 @@ | |
| 179973 | zFuncName); |
| 179974 | sqlite3_result_error(pCtx, zMsg, -1); |
| 179975 | sqlite3_free(zMsg); |
| 179976 | } |
| 179977 | |
| 179978 | /* |
| 179979 | ** Mark all NULL entries in the Object passed in as JNODE_REMOVE. |
| 179980 | */ |
| 179981 | static void jsonRemoveAllNulls(JsonNode *pNode){ |
| 179982 | int i, n; |
| 179983 | assert( pNode->eType==JSON_OBJECT ); |
| 179984 | n = pNode->n; |
| 179985 | for(i=2; i<=n; i += jsonNodeSize(&pNode[i])+1){ |
| 179986 | switch( pNode[i].eType ){ |
| 179987 | case JSON_NULL: |
| 179988 | pNode[i].jnFlags |= JNODE_REMOVE; |
| 179989 | break; |
| 179990 | case JSON_OBJECT: |
| 179991 | jsonRemoveAllNulls(&pNode[i]); |
| 179992 | break; |
| 179993 | } |
| 179994 | } |
| 179995 | } |
| 179996 | |
| 179997 | |
| 179998 | /**************************************************************************** |
| 179999 | ** SQL functions used for testing and debugging |
| 180000 | ****************************************************************************/ |
| 180001 | |
| @@ -180157,20 +180201,16 @@ | |
| 180201 | } |
| 180202 | assert( iTarget>=0 && iTarget<pParse->nNode ); |
| 180203 | pTarget = &pParse->aNode[iTarget]; |
| 180204 | assert( (pPatch->jnFlags & JNODE_APPEND)==0 ); |
| 180205 | if( pTarget->eType!=JSON_OBJECT ){ |
| 180206 | jsonRemoveAllNulls(pPatch); |
| 180207 | return pPatch; |
| 180208 | } |
| 180209 | iRoot = iTarget; |
| 180210 | for(i=1; i<pPatch->n; i += jsonNodeSize(&pPatch[i+1])+1){ |
| 180211 | u32 nKey; |
| 180212 | const char *zKey; |
| 180213 | assert( pPatch[i].eType==JSON_STRING ); |
| 180214 | assert( pPatch[i].jnFlags & JNODE_LABEL ); |
| 180215 | nKey = pPatch[i].n; |
| 180216 | zKey = pPatch[i].u.zJContent; |
| @@ -180199,10 +180239,11 @@ | |
| 180239 | int iStart, iPatch; |
| 180240 | iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); |
| 180241 | jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); |
| 180242 | iPatch = jsonParseAddNode(pParse, JSON_TRUE, 0, 0); |
| 180243 | if( pParse->oom ) return 0; |
| 180244 | jsonRemoveAllNulls(pPatch); |
| 180245 | pTarget = &pParse->aNode[iTarget]; |
| 180246 | pParse->aNode[iRoot].jnFlags |= JNODE_APPEND; |
| 180247 | pParse->aNode[iRoot].u.iAppend = iStart - iRoot; |
| 180248 | iRoot = iStart; |
| 180249 | pParse->aNode[iPatch].jnFlags |= JNODE_PATCH; |
| @@ -198207,11 +198248,11 @@ | |
| 198248 | int nArg, /* Number of args */ |
| 198249 | sqlite3_value **apUnused /* Function arguments */ |
| 198250 | ){ |
| 198251 | assert( nArg==0 ); |
| 198252 | UNUSED_PARAM2(nArg, apUnused); |
| 198253 | sqlite3_result_text(pCtx, "fts5: 2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4", -1, SQLITE_TRANSIENT); |
| 198254 | } |
| 198255 | |
| 198256 | static int fts5Init(sqlite3 *db){ |
| 198257 | static const sqlite3_module fts5Mod = { |
| 198258 | /* iVersion */ 2, |
| 198259 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -121,11 +121,11 @@ | ||
| 121 | 121 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 122 | 122 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 123 | 123 | */ |
| 124 | 124 | #define SQLITE_VERSION "3.18.0" |
| 125 | 125 | #define SQLITE_VERSION_NUMBER 3018000 |
| 126 | -#define SQLITE_SOURCE_ID "2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc" | |
| 126 | +#define SQLITE_SOURCE_ID "2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4" | |
| 127 | 127 | |
| 128 | 128 | /* |
| 129 | 129 | ** CAPI3REF: Run-Time Library Version Numbers |
| 130 | 130 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 131 | 131 | ** |
| 132 | 132 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -121,11 +121,11 @@ | |
| 121 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 122 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 123 | */ |
| 124 | #define SQLITE_VERSION "3.18.0" |
| 125 | #define SQLITE_VERSION_NUMBER 3018000 |
| 126 | #define SQLITE_SOURCE_ID "2017-03-23 23:44:55 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc" |
| 127 | |
| 128 | /* |
| 129 | ** CAPI3REF: Run-Time Library Version Numbers |
| 130 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 131 | ** |
| 132 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -121,11 +121,11 @@ | |
| 121 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 122 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 123 | */ |
| 124 | #define SQLITE_VERSION "3.18.0" |
| 125 | #define SQLITE_VERSION_NUMBER 3018000 |
| 126 | #define SQLITE_SOURCE_ID "2017-03-24 19:45:05 c2c3dd84534bb5ea81c974847b74a166c9cba1545fc749ce625929f303bf22e4" |
| 127 | |
| 128 | /* |
| 129 | ** CAPI3REF: Run-Time Library Version Numbers |
| 130 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 131 | ** |
| 132 |