mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Upgrade libsqlite 3 inside PDO sqlite to version 3.3.15
This commit is contained in:
parent
857f992cd3
commit
eb8d30f912
51 changed files with 5351 additions and 3624 deletions
|
@ -211,7 +211,7 @@ static void applyNumericAffinity(Mem *pRec){
|
|||
sqlite3VdbeChangeEncoding(pRec, SQLITE_UTF8);
|
||||
if( !realnum && sqlite3atoi64(pRec->z, &value) ){
|
||||
sqlite3VdbeMemRelease(pRec);
|
||||
pRec->i = value;
|
||||
pRec->u.i = value;
|
||||
pRec->flags = MEM_Int;
|
||||
}else{
|
||||
sqlite3VdbeMemRealify(pRec);
|
||||
|
@ -454,6 +454,7 @@ int sqlite3VdbeExec(
|
|||
p->resOnStack = 0;
|
||||
db->busyHandler.nBusy = 0;
|
||||
CHECK_FOR_INTERRUPT;
|
||||
sqlite3VdbeIOTraceSql(p);
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( (p->db->flags & SQLITE_VdbeListing)!=0
|
||||
|| sqlite3OsFileExists("vdbe_explain")
|
||||
|
@ -669,7 +670,7 @@ case OP_Halt: { /* no-push */
|
|||
case OP_Integer: {
|
||||
pTos++;
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = pOp->p1;
|
||||
pTos->u.i = pOp->p1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -685,7 +686,7 @@ case OP_Int64: {
|
|||
pTos->z = pOp->p3;
|
||||
pTos->n = strlen(pTos->z);
|
||||
pTos->enc = SQLITE_UTF8;
|
||||
pTos->i = sqlite3VdbeIntValue(pTos);
|
||||
pTos->u.i = sqlite3VdbeIntValue(pTos);
|
||||
pTos->flags |= MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -1098,8 +1099,8 @@ case OP_Remainder: { /* same as TK_REM, no-push */
|
|||
pTos->flags = MEM_Null;
|
||||
}else if( (pTos->flags & pNos->flags & MEM_Int)==MEM_Int ){
|
||||
i64 a, b;
|
||||
a = pTos->i;
|
||||
b = pNos->i;
|
||||
a = pTos->u.i;
|
||||
b = pNos->u.i;
|
||||
switch( pOp->opcode ){
|
||||
case OP_Add: b += a; break;
|
||||
case OP_Subtract: b -= a; break;
|
||||
|
@ -1118,7 +1119,7 @@ case OP_Remainder: { /* same as TK_REM, no-push */
|
|||
Release(pTos);
|
||||
pTos--;
|
||||
Release(pTos);
|
||||
pTos->i = b;
|
||||
pTos->u.i = b;
|
||||
pTos->flags = MEM_Int;
|
||||
}else{
|
||||
double a, b;
|
||||
|
@ -1309,7 +1310,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, no-push */
|
|||
Release(pTos);
|
||||
pTos--;
|
||||
Release(pTos);
|
||||
pTos->i = a;
|
||||
pTos->u.i = a;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -1324,7 +1325,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, no-push */
|
|||
case OP_AddImm: { /* no-push */
|
||||
assert( pTos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
pTos->i += pOp->p1;
|
||||
pTos->u.i += pOp->p1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1349,7 +1350,7 @@ case OP_ForceInt: { /* no-push */
|
|||
break;
|
||||
}
|
||||
if( pTos->flags & MEM_Int ){
|
||||
v = pTos->i + (pOp->p1!=0);
|
||||
v = pTos->u.i + (pOp->p1!=0);
|
||||
}else{
|
||||
/* FIX ME: should this not be assert( pTos->flags & MEM_Real ) ??? */
|
||||
sqlite3VdbeMemRealify(pTos);
|
||||
|
@ -1358,7 +1359,7 @@ case OP_ForceInt: { /* no-push */
|
|||
if( pOp->p1 && pTos->r==(double)v ) v++;
|
||||
}
|
||||
Release(pTos);
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -1647,7 +1648,7 @@ case OP_Ge: { /* same as TK_GE, no-push */
|
|||
}else{
|
||||
pTos++;
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = res;
|
||||
pTos->u.i = res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1674,13 +1675,13 @@ case OP_Or: { /* same as TK_OR, no-push */
|
|||
v1 = 2;
|
||||
}else{
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
v1 = pTos->i==0;
|
||||
v1 = pTos->u.i==0;
|
||||
}
|
||||
if( pNos->flags & MEM_Null ){
|
||||
v2 = 2;
|
||||
}else{
|
||||
sqlite3VdbeMemIntegerify(pNos);
|
||||
v2 = pNos->i==0;
|
||||
v2 = pNos->u.i==0;
|
||||
}
|
||||
if( pOp->opcode==OP_And ){
|
||||
static const unsigned char and_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };
|
||||
|
@ -1694,7 +1695,7 @@ case OP_Or: { /* same as TK_OR, no-push */
|
|||
if( v1==2 ){
|
||||
pTos->flags = MEM_Null;
|
||||
}else{
|
||||
pTos->i = v1==0;
|
||||
pTos->u.i = v1==0;
|
||||
pTos->flags = MEM_Int;
|
||||
}
|
||||
break;
|
||||
|
@ -1724,8 +1725,8 @@ case OP_AbsValue: {
|
|||
pTos->flags = MEM_Real;
|
||||
}else if( pTos->flags & MEM_Int ){
|
||||
Release(pTos);
|
||||
if( pOp->opcode==OP_Negative || pTos->i<0 ){
|
||||
pTos->i = -pTos->i;
|
||||
if( pOp->opcode==OP_Negative || pTos->u.i<0 ){
|
||||
pTos->u.i = -pTos->u.i;
|
||||
}
|
||||
pTos->flags = MEM_Int;
|
||||
}else if( pTos->flags & MEM_Null ){
|
||||
|
@ -1748,7 +1749,7 @@ case OP_Not: { /* same as TK_NOT, no-push */
|
|||
if( pTos->flags & MEM_Null ) break; /* Do nothing to NULLs */
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos->i = !pTos->i;
|
||||
pTos->u.i = !pTos->u.i;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -1764,7 +1765,7 @@ case OP_BitNot: { /* same as TK_BITNOT, no-push */
|
|||
if( pTos->flags & MEM_Null ) break; /* Do nothing to NULLs */
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos->i = ~pTos->i;
|
||||
pTos->u.i = ~pTos->u.i;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -1936,6 +1937,9 @@ case OP_Column: {
|
|||
** which is the number of records.
|
||||
*/
|
||||
pC = p->apCsr[p1];
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
assert( pC->pVtabCursor==0 );
|
||||
#endif
|
||||
assert( pC!=0 );
|
||||
if( pC->pCursor!=0 ){
|
||||
/* The record is stored in a B-Tree */
|
||||
|
@ -2445,7 +2449,7 @@ case OP_ReadCookie: {
|
|||
*/
|
||||
rc = sqlite3BtreeGetMeta(db->aDb[pOp->p1].pBt, 1 + pOp->p2, (u32 *)&iMeta);
|
||||
pTos++;
|
||||
pTos->i = iMeta;
|
||||
pTos->u.i = iMeta;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -2469,14 +2473,14 @@ case OP_SetCookie: { /* no-push */
|
|||
assert( pTos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
/* See note about index shifting on OP_ReadCookie */
|
||||
rc = sqlite3BtreeUpdateMeta(pDb->pBt, 1+pOp->p2, (int)pTos->i);
|
||||
rc = sqlite3BtreeUpdateMeta(pDb->pBt, 1+pOp->p2, (int)pTos->u.i);
|
||||
if( pOp->p2==0 ){
|
||||
/* When the schema cookie changes, record the new cookie internally */
|
||||
pDb->pSchema->schema_cookie = pTos->i;
|
||||
pDb->pSchema->schema_cookie = pTos->u.i;
|
||||
db->flags |= SQLITE_InternChanges;
|
||||
}else if( pOp->p2==1 ){
|
||||
/* Record changes in the file format */
|
||||
pDb->pSchema->file_format = pTos->i;
|
||||
pDb->pSchema->file_format = pTos->u.i;
|
||||
}
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos--;
|
||||
|
@ -2578,7 +2582,7 @@ case OP_OpenWrite: { /* no-push */
|
|||
|
||||
assert( pTos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
iDb = pTos->i;
|
||||
iDb = pTos->u.i;
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos--;
|
||||
assert( iDb>=0 && iDb<db->nDb );
|
||||
|
@ -2596,7 +2600,7 @@ case OP_OpenWrite: { /* no-push */
|
|||
if( p2<=0 ){
|
||||
assert( pTos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
p2 = pTos->i;
|
||||
p2 = pTos->u.i;
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos--;
|
||||
assert( p2>=2 );
|
||||
|
@ -2822,7 +2826,7 @@ case OP_MoveGt: { /* no-push */
|
|||
if( pC->isTable ){
|
||||
i64 iKey;
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
iKey = intToKey(pTos->i);
|
||||
iKey = intToKey(pTos->u.i);
|
||||
if( pOp->p2==0 && pOp->opcode==OP_MoveGe ){
|
||||
pC->movetoTarget = iKey;
|
||||
pC->deferredMoveto = 1;
|
||||
|
@ -2830,16 +2834,16 @@ case OP_MoveGt: { /* no-push */
|
|||
pTos--;
|
||||
break;
|
||||
}
|
||||
rc = sqlite3BtreeMoveto(pC->pCursor, 0, (u64)iKey, &res);
|
||||
rc = sqlite3BtreeMoveto(pC->pCursor, 0, (u64)iKey, 0, &res);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
pC->lastRowid = pTos->i;
|
||||
pC->lastRowid = pTos->u.i;
|
||||
pC->rowidIsValid = res==0;
|
||||
}else{
|
||||
assert( pTos->flags & MEM_Blob );
|
||||
/* Stringify(pTos, encoding); */
|
||||
rc = sqlite3BtreeMoveto(pC->pCursor, pTos->z, pTos->n, &res);
|
||||
rc = sqlite3BtreeMoveto(pC->pCursor, pTos->z, pTos->n, 0, &res);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
|
@ -2946,7 +2950,7 @@ case OP_Found: { /* no-push */
|
|||
int res, rx;
|
||||
assert( pC->isTable==0 );
|
||||
Stringify(pTos, encoding);
|
||||
rx = sqlite3BtreeMoveto(pC->pCursor, pTos->z, pTos->n, &res);
|
||||
rx = sqlite3BtreeMoveto(pC->pCursor, pTos->z, pTos->n, 0, &res);
|
||||
alreadyExists = rx==SQLITE_OK && res==0;
|
||||
pC->deferredMoveto = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
|
@ -2995,7 +2999,7 @@ case OP_IsUnique: { /* no-push */
|
|||
*/
|
||||
assert( pNos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
R = pTos->i;
|
||||
R = pTos->u.i;
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos--;
|
||||
assert( i>=0 && i<p->nCursor );
|
||||
|
@ -3024,7 +3028,7 @@ case OP_IsUnique: { /* no-push */
|
|||
*/
|
||||
assert( pCx->deferredMoveto==0 );
|
||||
pCx->cacheStatus = CACHE_STALE;
|
||||
rc = sqlite3BtreeMoveto(pCrsr, zKey, len, &res);
|
||||
rc = sqlite3BtreeMoveto(pCrsr, zKey, len, 0, &res);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
|
@ -3061,7 +3065,7 @@ case OP_IsUnique: { /* no-push */
|
|||
** constraint.)
|
||||
*/
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
}
|
||||
break;
|
||||
|
@ -3093,15 +3097,17 @@ case OP_NotExists: { /* no-push */
|
|||
u64 iKey;
|
||||
assert( pTos->flags & MEM_Int );
|
||||
assert( p->apCsr[i]->isTable );
|
||||
iKey = intToKey(pTos->i);
|
||||
rc = sqlite3BtreeMoveto(pCrsr, 0, iKey, &res);
|
||||
pC->lastRowid = pTos->i;
|
||||
iKey = intToKey(pTos->u.i);
|
||||
rc = sqlite3BtreeMoveto(pCrsr, 0, iKey, 0,&res);
|
||||
pC->lastRowid = pTos->u.i;
|
||||
pC->rowidIsValid = res==0;
|
||||
pC->nullRow = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
/* res might be uninitialized if rc!=SQLITE_OK. But if rc!=SQLITE_OK
|
||||
** processing is about to abort so we really do not care whether or not
|
||||
** the following jump is taken. */
|
||||
** the following jump is taken. (In other words, do not stress over
|
||||
** the error that valgrind sometimes shows on the next statement when
|
||||
** running ioerr.test and similar failure-recovery test scripts.) */
|
||||
if( res!=0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
pC->rowidIsValid = 0;
|
||||
|
@ -3124,7 +3130,7 @@ case OP_Sequence: {
|
|||
assert( i>=0 && i<p->nCursor );
|
||||
assert( p->apCsr[i]!=0 );
|
||||
pTos++;
|
||||
pTos->i = p->apCsr[i]->seqCount++;
|
||||
pTos->u.i = p->apCsr[i]->seqCount++;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -3233,14 +3239,14 @@ case OP_NewRowid: {
|
|||
pMem = &p->aMem[pOp->p2];
|
||||
sqlite3VdbeMemIntegerify(pMem);
|
||||
assert( (pMem->flags & MEM_Int)!=0 ); /* mem(P2) holds an integer */
|
||||
if( pMem->i==MAX_ROWID || pC->useRandomRowid ){
|
||||
if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){
|
||||
rc = SQLITE_FULL;
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
if( v<pMem->i+1 ){
|
||||
v = pMem->i + 1;
|
||||
if( v<pMem->u.i+1 ){
|
||||
v = pMem->u.i + 1;
|
||||
}
|
||||
pMem->i = v;
|
||||
pMem->u.i = v;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3266,7 +3272,7 @@ case OP_NewRowid: {
|
|||
}
|
||||
if( v==0 ) continue;
|
||||
x = intToKey(v);
|
||||
rx = sqlite3BtreeMoveto(pC->pCursor, 0, (u64)x, &res);
|
||||
rx = sqlite3BtreeMoveto(pC->pCursor, 0, (u64)x, 0, &res);
|
||||
cnt++;
|
||||
}while( cnt<1000 && rx==SQLITE_OK && res==0 );
|
||||
db->priorNewRowid = v;
|
||||
|
@ -3280,7 +3286,7 @@ case OP_NewRowid: {
|
|||
pC->cacheStatus = CACHE_STALE;
|
||||
}
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -3317,11 +3323,11 @@ case OP_Insert: { /* no-push */
|
|||
|
||||
assert( pNos->flags & MEM_Int );
|
||||
assert( pC->isTable );
|
||||
iKey = intToKey(pNos->i);
|
||||
iKey = intToKey(pNos->u.i);
|
||||
|
||||
if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++;
|
||||
if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->i;
|
||||
if( pC->nextRowidValid && pNos->i>=pC->nextRowid ){
|
||||
if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->u.i;
|
||||
if( pC->nextRowidValid && pNos->u.i>=pC->nextRowid ){
|
||||
pC->nextRowidValid = 0;
|
||||
}
|
||||
if( pTos->flags & MEM_Null ){
|
||||
|
@ -3346,7 +3352,9 @@ case OP_Insert: { /* no-push */
|
|||
}
|
||||
pC->nullRow = 0;
|
||||
}else{
|
||||
rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey, pTos->z, pTos->n);
|
||||
rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey,
|
||||
pTos->z, pTos->n,
|
||||
pOp->p2 & OPFLAG_APPEND);
|
||||
}
|
||||
|
||||
pC->rowidIsValid = 0;
|
||||
|
@ -3500,9 +3508,9 @@ case OP_RowData: {
|
|||
pTos->z = z;
|
||||
}
|
||||
if( pC->isIndex ){
|
||||
sqlite3BtreeKey(pCrsr, 0, n, pTos->z);
|
||||
rc = sqlite3BtreeKey(pCrsr, 0, n, pTos->z);
|
||||
}else{
|
||||
sqlite3BtreeData(pCrsr, 0, n, pTos->z);
|
||||
rc = sqlite3BtreeData(pCrsr, 0, n, pTos->z);
|
||||
}
|
||||
}else if( pC->pseudoTable ){
|
||||
pTos->n = pC->nData;
|
||||
|
@ -3543,7 +3551,7 @@ case OP_Rowid: {
|
|||
sqlite3BtreeKeySize(pC->pCursor, &v);
|
||||
v = keyToInt(v);
|
||||
}
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
@ -3673,7 +3681,9 @@ case OP_Next: { /* no-push */
|
|||
CHECK_FOR_INTERRUPT;
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
pC = p->apCsr[pOp->p1];
|
||||
assert( pC!=0 );
|
||||
if( pC==0 ){
|
||||
break; /* See ticket #2273 */
|
||||
}
|
||||
if( (pCrsr = pC->pCursor)!=0 ){
|
||||
int res;
|
||||
if( pC->nullRow ){
|
||||
|
@ -3698,12 +3708,15 @@ case OP_Next: { /* no-push */
|
|||
break;
|
||||
}
|
||||
|
||||
/* Opcode: IdxInsert P1 * *
|
||||
/* Opcode: IdxInsert P1 P2 *
|
||||
**
|
||||
** The top of the stack holds a SQL index key made using either the
|
||||
** MakeIdxRec or MakeRecord instructions. This opcode writes that key
|
||||
** into the index P1. Data for the entry is nil.
|
||||
**
|
||||
** P2 is a flag that provides a hint to the b-tree layer that this
|
||||
** insert is likely to be an append.
|
||||
**
|
||||
** This instruction only works for indices. The equivalent instruction
|
||||
** for tables is OP_Insert.
|
||||
*/
|
||||
|
@ -3715,12 +3728,11 @@ case OP_IdxInsert: { /* no-push */
|
|||
assert( i>=0 && i<p->nCursor );
|
||||
assert( p->apCsr[i]!=0 );
|
||||
assert( pTos->flags & MEM_Blob );
|
||||
assert( pOp->p2==0 );
|
||||
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
|
||||
int nKey = pTos->n;
|
||||
const char *zKey = pTos->z;
|
||||
assert( pC->isTable==0 );
|
||||
rc = sqlite3BtreeInsert(pCrsr, zKey, nKey, "", 0);
|
||||
rc = sqlite3BtreeInsert(pCrsr, zKey, nKey, "", 0, pOp->p2);
|
||||
assert( pC->deferredMoveto==0 );
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
}
|
||||
|
@ -3745,7 +3757,7 @@ case OP_IdxDelete: { /* no-push */
|
|||
assert( p->apCsr[i]!=0 );
|
||||
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
|
||||
int res;
|
||||
rc = sqlite3BtreeMoveto(pCrsr, pTos->z, pTos->n, &res);
|
||||
rc = sqlite3BtreeMoveto(pCrsr, pTos->z, pTos->n, 0, &res);
|
||||
if( rc==SQLITE_OK && res==0 ){
|
||||
rc = sqlite3BtreeDelete(pCrsr);
|
||||
}
|
||||
|
@ -3787,7 +3799,7 @@ case OP_IdxRowid: {
|
|||
goto abort_due_to_error;
|
||||
}
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = rowid;
|
||||
pTos->u.i = rowid;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3914,7 +3926,7 @@ case OP_Destroy: {
|
|||
rc = sqlite3BtreeDropTable(db->aDb[pOp->p2].pBt, pOp->p1, &iMoved);
|
||||
pTos++;
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = iMoved;
|
||||
pTos->u.i = iMoved;
|
||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||
if( rc==SQLITE_OK && iMoved!=0 ){
|
||||
sqlite3RootPageMoved(&db->aDb[pOp->p2], iMoved, pOp->p1);
|
||||
|
@ -4013,7 +4025,7 @@ case OP_CreateTable: {
|
|||
rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
|
||||
pTos++;
|
||||
if( rc==SQLITE_OK ){
|
||||
pTos->i = pgno;
|
||||
pTos->u.i = pgno;
|
||||
pTos->flags = MEM_Int;
|
||||
}else{
|
||||
pTos->flags = MEM_Null;
|
||||
|
@ -4160,14 +4172,14 @@ case OP_IntegrityCk: {
|
|||
assert( (pnErr->flags & MEM_Int)!=0 );
|
||||
for(j=0; j<nRoot; j++){
|
||||
Mem *pMem = &pTos[-j];
|
||||
aRoot[j] = pMem->i;
|
||||
aRoot[j] = pMem->u.i;
|
||||
}
|
||||
aRoot[j] = 0;
|
||||
popStack(&pTos, nRoot);
|
||||
pTos++;
|
||||
z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p2].pBt, aRoot, nRoot,
|
||||
pnErr->i, &nErr);
|
||||
pnErr->i -= nErr;
|
||||
pnErr->u.i, &nErr);
|
||||
pnErr->u.i -= nErr;
|
||||
if( nErr==0 ){
|
||||
assert( z==0 );
|
||||
pTos->flags = MEM_Null;
|
||||
|
@ -4192,7 +4204,7 @@ case OP_IntegrityCk: {
|
|||
case OP_FifoWrite: { /* no-push */
|
||||
assert( pTos>=p->aStack );
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
sqlite3VdbeFifoPush(&p->sFifo, pTos->i);
|
||||
sqlite3VdbeFifoPush(&p->sFifo, pTos->u.i);
|
||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||
pTos--;
|
||||
break;
|
||||
|
@ -4211,7 +4223,7 @@ case OP_FifoRead: {
|
|||
pc = pOp->p2 - 1;
|
||||
}else{
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
}
|
||||
break;
|
||||
|
@ -4232,7 +4244,8 @@ case OP_ContextPush: { /* no-push */
|
|||
/* FIX ME: This should be allocated as part of the vdbe at compile-time */
|
||||
if( i>=p->contextStackDepth ){
|
||||
p->contextStackDepth = i+1;
|
||||
sqliteReallocOrFree((void**)&p->contextStack, sizeof(Context)*(i+1));
|
||||
p->contextStack = sqliteReallocOrFree(p->contextStack,
|
||||
sizeof(Context)*(i+1));
|
||||
if( p->contextStack==0 ) goto no_mem;
|
||||
}
|
||||
pContext = &p->contextStack[i];
|
||||
|
@ -4317,8 +4330,8 @@ case OP_MemMax: { /* no-push */
|
|||
pMem = &p->aMem[i];
|
||||
sqlite3VdbeMemIntegerify(pMem);
|
||||
sqlite3VdbeMemIntegerify(pTos);
|
||||
if( pMem->i<pTos->i){
|
||||
pMem->i = pTos->i;
|
||||
if( pMem->u.i<pTos->u.i){
|
||||
pMem->u.i = pTos->u.i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -4337,7 +4350,7 @@ case OP_MemIncr: { /* no-push */
|
|||
assert( i>=0 && i<p->nMem );
|
||||
pMem = &p->aMem[i];
|
||||
assert( pMem->flags==MEM_Int );
|
||||
pMem->i += pOp->p1;
|
||||
pMem->u.i += pOp->p1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4354,7 +4367,7 @@ case OP_IfMemPos: { /* no-push */
|
|||
assert( i>=0 && i<p->nMem );
|
||||
pMem = &p->aMem[i];
|
||||
assert( pMem->flags==MEM_Int );
|
||||
if( pMem->i>0 ){
|
||||
if( pMem->u.i>0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
}
|
||||
break;
|
||||
|
@ -4373,7 +4386,7 @@ case OP_IfMemNeg: { /* no-push */
|
|||
assert( i>=0 && i<p->nMem );
|
||||
pMem = &p->aMem[i];
|
||||
assert( pMem->flags==MEM_Int );
|
||||
if( pMem->i<0 ){
|
||||
if( pMem->u.i<0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
}
|
||||
break;
|
||||
|
@ -4392,7 +4405,7 @@ case OP_IfMemZero: { /* no-push */
|
|||
assert( i>=0 && i<p->nMem );
|
||||
pMem = &p->aMem[i];
|
||||
assert( pMem->flags==MEM_Int );
|
||||
if( pMem->i==0 ){
|
||||
if( pMem->u.i==0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
}
|
||||
break;
|
||||
|
@ -4506,7 +4519,7 @@ case OP_AggFinal: { /* no-push */
|
|||
}
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_VACUUM
|
||||
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
|
||||
/* Opcode: Vacuum * * *
|
||||
**
|
||||
** Vacuum the entire database. This opcode will cause other virtual
|
||||
|
@ -4679,7 +4692,7 @@ case OP_VFilter: { /* no-push */
|
|||
/* Grab the index number and argc parameters off the top of the stack. */
|
||||
assert( (&pTos[-1])>=p->aStack );
|
||||
assert( (pTos[0].flags&MEM_Int)!=0 && pTos[-1].flags==MEM_Int );
|
||||
nArg = pTos[-1].i;
|
||||
nArg = pTos[-1].u.i;
|
||||
|
||||
/* Invoke the xFilter method */
|
||||
{
|
||||
|
@ -4693,7 +4706,7 @@ case OP_VFilter: { /* no-push */
|
|||
|
||||
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
|
||||
p->inVtabMethod = 1;
|
||||
rc = pModule->xFilter(pCur->pVtabCursor, pTos->i, pOp->p3, nArg, apArg);
|
||||
rc = pModule->xFilter(pCur->pVtabCursor, pTos->u.i, pOp->p3, nArg, apArg);
|
||||
p->inVtabMethod = 0;
|
||||
if( rc==SQLITE_OK ){
|
||||
res = pModule->xEof(pCur->pVtabCursor);
|
||||
|
@ -4735,7 +4748,7 @@ case OP_VRowid: {
|
|||
|
||||
pTos++;
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = iRow;
|
||||
pTos->u.i = iRow;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -4934,9 +4947,9 @@ default: {
|
|||
if( pTos[i].flags & MEM_Null ){
|
||||
fprintf(p->trace, " NULL");
|
||||
}else if( (pTos[i].flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
|
||||
fprintf(p->trace, " si:%lld", pTos[i].i);
|
||||
fprintf(p->trace, " si:%lld", pTos[i].u.i);
|
||||
}else if( pTos[i].flags & MEM_Int ){
|
||||
fprintf(p->trace, " i:%lld", pTos[i].i);
|
||||
fprintf(p->trace, " i:%lld", pTos[i].u.i);
|
||||
}else if( pTos[i].flags & MEM_Real ){
|
||||
fprintf(p->trace, " r:%g", pTos[i].r);
|
||||
}else{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue