mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Remove the anonymous union from the sqlite3_value structure since some
compilers are unable to deal with it. (CVS 3758) FossilOrigin-Name: 6b995259bc974519379dee55c1ef00d28c76bf21
This commit is contained in:
20
manifest
20
manifest
@@ -1,5 +1,5 @@
|
||||
C Comment\schanges\sin\sbtree.c\sand\sadded\sa\smissing\s"else"\sin\spragma.c.\s(CVS\s3757)
|
||||
D 2007-03-30T11:12:08
|
||||
C Remove\sthe\sanonymous\sunion\sfrom\sthe\ssqlite3_value\sstructure\ssince\ssome\ncompilers\sare\sunable\sto\sdeal\swith\sit.\s(CVS\s3758)
|
||||
D 2007-03-30T11:23:45
|
||||
F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@@ -123,13 +123,13 @@ F src/update.c 3359041db390a8f856d67272f299600e2104f350
|
||||
F src/utf.c 67ecb1032bc0b42c105e88d65ef9d9f626eb0e1f
|
||||
F src/util.c 8e8180ee5597f2474c1da311ff3c464b6966c0f1
|
||||
F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
|
||||
F src/vdbe.c e214ce8f760f839d7171714f895e362facaae4dd
|
||||
F src/vdbe.c d5a4fc1e18af2a2873d022450c4a776f6c17bac3
|
||||
F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
|
||||
F src/vdbeInt.h b2ca85ca8abfbba86e380b06c7673dc81c6784c3
|
||||
F src/vdbeapi.c 6cff63a5b3a52af04b2bef0f7e27ed7ea6f85183
|
||||
F src/vdbeaux.c 2cf328d44683f1d6b537809536873b1999be6f20
|
||||
F src/vdbeInt.h 4b19fd8febad3fd14c4c97adaefc06754d323132
|
||||
F src/vdbeapi.c 7ac14f2e3b2283dcd35f5edefd31a8342cff783c
|
||||
F src/vdbeaux.c d768c22c8aa0fbf9bf1408b4fc9ed0b38b1146ca
|
||||
F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
|
||||
F src/vdbemem.c 58a8be2231b0b13e2e77098debe173e79d22f791
|
||||
F src/vdbemem.c d3696b4b0e5f32272659816cdfa2348c650b1ba0
|
||||
F src/vtab.c 7fbda947e28cbe7adb3ba752a76ca9ef29936750
|
||||
F src/where.c b5f8e2a0b0758b631c236aef3c7ed9c3b197eae8
|
||||
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
||||
@@ -447,7 +447,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P ea49ddf64aa6073b8018dc2faaf199704d359412
|
||||
R 22ce942b887da75ba44b7e076e36f7c6
|
||||
P 9a7d7e31908e9bac14a68bbc2fb4e1ca593ea234
|
||||
R 96b0eb3d9aac4cea00de02819c2dff8c
|
||||
U drh
|
||||
Z 7ba311631083a1f0131b460fe5fb57bd
|
||||
Z 42c64bfd0c87e235823de57a2239ca19
|
||||
|
@@ -1 +1 @@
|
||||
9a7d7e31908e9bac14a68bbc2fb4e1ca593ea234
|
||||
6b995259bc974519379dee55c1ef00d28c76bf21
|
120
src/vdbe.c
120
src/vdbe.c
@@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.596 2007/03/29 05:51:49 drh Exp $
|
||||
** $Id: vdbe.c,v 1.597 2007/03/30 11:23:45 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -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);
|
||||
@@ -670,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;
|
||||
}
|
||||
|
||||
@@ -686,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;
|
||||
}
|
||||
@@ -1099,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;
|
||||
@@ -1119,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;
|
||||
@@ -1310,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;
|
||||
}
|
||||
@@ -1325,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;
|
||||
}
|
||||
|
||||
@@ -1350,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);
|
||||
@@ -1359,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;
|
||||
}
|
||||
@@ -1648,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;
|
||||
}
|
||||
@@ -1675,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 };
|
||||
@@ -1695,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;
|
||||
@@ -1725,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 ){
|
||||
@@ -1749,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;
|
||||
}
|
||||
@@ -1765,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;
|
||||
}
|
||||
@@ -2449,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;
|
||||
}
|
||||
@@ -2473,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--;
|
||||
@@ -2582,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 );
|
||||
@@ -2600,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 );
|
||||
@@ -2826,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;
|
||||
@@ -2838,7 +2838,7 @@ case OP_MoveGt: { /* no-push */
|
||||
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 );
|
||||
@@ -2999,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 );
|
||||
@@ -3065,7 +3065,7 @@ case OP_IsUnique: { /* no-push */
|
||||
** constraint.)
|
||||
*/
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
}
|
||||
break;
|
||||
@@ -3097,9 +3097,9 @@ case OP_NotExists: { /* no-push */
|
||||
u64 iKey;
|
||||
assert( pTos->flags & MEM_Int );
|
||||
assert( p->apCsr[i]->isTable );
|
||||
iKey = intToKey(pTos->i);
|
||||
iKey = intToKey(pTos->u.i);
|
||||
rc = sqlite3BtreeMoveto(pCrsr, 0, iKey, 0,&res);
|
||||
pC->lastRowid = pTos->i;
|
||||
pC->lastRowid = pTos->u.i;
|
||||
pC->rowidIsValid = res==0;
|
||||
pC->nullRow = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
@@ -3128,7 +3128,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;
|
||||
}
|
||||
@@ -3237,14 +3237,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
|
||||
|
||||
@@ -3284,7 +3284,7 @@ case OP_NewRowid: {
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
}
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
@@ -3321,11 +3321,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 ){
|
||||
@@ -3549,7 +3549,7 @@ case OP_Rowid: {
|
||||
sqlite3BtreeKeySize(pC->pCursor, &v);
|
||||
v = keyToInt(v);
|
||||
}
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
@@ -3797,7 +3797,7 @@ case OP_IdxRowid: {
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = rowid;
|
||||
pTos->u.i = rowid;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3924,7 +3924,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);
|
||||
@@ -4023,7 +4023,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;
|
||||
@@ -4170,14 +4170,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;
|
||||
@@ -4202,7 +4202,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;
|
||||
@@ -4221,7 +4221,7 @@ case OP_FifoRead: {
|
||||
pc = pOp->p2 - 1;
|
||||
}else{
|
||||
pTos++;
|
||||
pTos->i = v;
|
||||
pTos->u.i = v;
|
||||
pTos->flags = MEM_Int;
|
||||
}
|
||||
break;
|
||||
@@ -4328,8 +4328,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;
|
||||
}
|
||||
@@ -4348,7 +4348,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;
|
||||
}
|
||||
|
||||
@@ -4365,7 +4365,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;
|
||||
@@ -4384,7 +4384,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;
|
||||
@@ -4403,7 +4403,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;
|
||||
@@ -4690,7 +4690,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 */
|
||||
{
|
||||
@@ -4704,7 +4704,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);
|
||||
@@ -4746,7 +4746,7 @@ case OP_VRowid: {
|
||||
|
||||
pTos++;
|
||||
pTos->flags = MEM_Int;
|
||||
pTos->i = iRow;
|
||||
pTos->u.i = iRow;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -4945,9 +4945,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{
|
||||
|
@@ -127,8 +127,8 @@ typedef struct Cursor Cursor;
|
||||
struct Mem {
|
||||
union {
|
||||
i64 i; /* Integer value. Or FuncDef* when flags==MEM_Agg */
|
||||
FuncDef *pDef;
|
||||
};
|
||||
FuncDef *pDef; /* Used only when flags==MEM_Agg */
|
||||
} u;
|
||||
double r; /* Real value */
|
||||
char *z; /* String or BLOB value */
|
||||
int n; /* Number of characters in string value, including '\0' */
|
||||
|
@@ -341,7 +341,7 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
|
||||
}else{
|
||||
pMem->flags = MEM_Agg;
|
||||
pMem->xDel = sqlite3FreeX;
|
||||
pMem->pDef = p->pFunc;
|
||||
pMem->u.pDef = p->pFunc;
|
||||
if( nByte<=NBFS ){
|
||||
pMem->z = pMem->zShort;
|
||||
memset(pMem->z, 0, nByte);
|
||||
|
@@ -719,7 +719,7 @@ int sqlite3VdbeList(
|
||||
Mem *pMem = p->aStack;
|
||||
pMem->flags = MEM_Int;
|
||||
pMem->type = SQLITE_INTEGER;
|
||||
pMem->i = i; /* Program counter */
|
||||
pMem->u.i = i; /* Program counter */
|
||||
pMem++;
|
||||
|
||||
pMem->flags = MEM_Static|MEM_Str|MEM_Term;
|
||||
@@ -731,12 +731,12 @@ int sqlite3VdbeList(
|
||||
pMem++;
|
||||
|
||||
pMem->flags = MEM_Int;
|
||||
pMem->i = pOp->p1; /* P1 */
|
||||
pMem->u.i = pOp->p1; /* P1 */
|
||||
pMem->type = SQLITE_INTEGER;
|
||||
pMem++;
|
||||
|
||||
pMem->flags = MEM_Int;
|
||||
pMem->i = pOp->p2; /* P2 */
|
||||
pMem->u.i = pOp->p2; /* P2 */
|
||||
pMem->type = SQLITE_INTEGER;
|
||||
pMem++;
|
||||
|
||||
@@ -1739,7 +1739,7 @@ u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
|
||||
if( flags&MEM_Int ){
|
||||
/* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
|
||||
# define MAX_6BYTE ((((i64)0x00001000)<<32)-1)
|
||||
i64 i = pMem->i;
|
||||
i64 i = pMem->u.i;
|
||||
u64 u;
|
||||
if( file_format>=4 && (i&1)==i ){
|
||||
return 8+i;
|
||||
@@ -1795,7 +1795,7 @@ int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem, int file_format){
|
||||
assert( sizeof(v)==sizeof(pMem->r) );
|
||||
memcpy(&v, &pMem->r, sizeof(v));
|
||||
}else{
|
||||
v = pMem->i;
|
||||
v = pMem->u.i;
|
||||
}
|
||||
len = i = sqlite3VdbeSerialTypeLen(serial_type);
|
||||
while( i-- ){
|
||||
@@ -1833,22 +1833,22 @@ int sqlite3VdbeSerialGet(
|
||||
break;
|
||||
}
|
||||
case 1: { /* 1-byte signed integer */
|
||||
pMem->i = (signed char)buf[0];
|
||||
pMem->u.i = (signed char)buf[0];
|
||||
pMem->flags = MEM_Int;
|
||||
return 1;
|
||||
}
|
||||
case 2: { /* 2-byte signed integer */
|
||||
pMem->i = (((signed char)buf[0])<<8) | buf[1];
|
||||
pMem->u.i = (((signed char)buf[0])<<8) | buf[1];
|
||||
pMem->flags = MEM_Int;
|
||||
return 2;
|
||||
}
|
||||
case 3: { /* 3-byte signed integer */
|
||||
pMem->i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
|
||||
pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
|
||||
pMem->flags = MEM_Int;
|
||||
return 3;
|
||||
}
|
||||
case 4: { /* 4-byte signed integer */
|
||||
pMem->i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
|
||||
pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
|
||||
pMem->flags = MEM_Int;
|
||||
return 4;
|
||||
}
|
||||
@@ -1856,7 +1856,7 @@ int sqlite3VdbeSerialGet(
|
||||
u64 x = (((signed char)buf[0])<<8) | buf[1];
|
||||
u32 y = (buf[2]<<24) | (buf[3]<<16) | (buf[4]<<8) | buf[5];
|
||||
x = (x<<32) | y;
|
||||
pMem->i = *(i64*)&x;
|
||||
pMem->u.i = *(i64*)&x;
|
||||
pMem->flags = MEM_Int;
|
||||
return 6;
|
||||
}
|
||||
@@ -1877,7 +1877,7 @@ int sqlite3VdbeSerialGet(
|
||||
y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
|
||||
x = (x<<32) | y;
|
||||
if( serial_type==6 ){
|
||||
pMem->i = *(i64*)&x;
|
||||
pMem->u.i = *(i64*)&x;
|
||||
pMem->flags = MEM_Int;
|
||||
}else{
|
||||
assert( sizeof(x)==8 && sizeof(pMem->r)==8 );
|
||||
@@ -1889,7 +1889,7 @@ int sqlite3VdbeSerialGet(
|
||||
}
|
||||
case 8: /* Integer 0 */
|
||||
case 9: { /* Integer 1 */
|
||||
pMem->i = serial_type-8;
|
||||
pMem->u.i = serial_type-8;
|
||||
pMem->flags = MEM_Int;
|
||||
return 0;
|
||||
}
|
||||
@@ -2045,7 +2045,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
|
||||
sqlite3GetVarint32((u8*)&m.z[szHdr-1], &typeRowid);
|
||||
lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
|
||||
sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
|
||||
*rowid = v.i;
|
||||
*rowid = v.u.i;
|
||||
sqlite3VdbeMemRelease(&m);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
@@ -170,7 +170,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, int enc){
|
||||
** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
|
||||
*/
|
||||
if( fg & MEM_Int ){
|
||||
sqlite3_snprintf(NBFS, z, "%lld", pMem->i);
|
||||
sqlite3_snprintf(NBFS, z, "%lld", pMem->u.i);
|
||||
}else{
|
||||
assert( fg & MEM_Real );
|
||||
sqlite3_snprintf(NBFS, z, "%!.15g", pMem->r);
|
||||
@@ -195,7 +195,7 @@ int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
|
||||
int rc = SQLITE_OK;
|
||||
if( pFunc && pFunc->xFinalize ){
|
||||
sqlite3_context ctx;
|
||||
assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->pDef );
|
||||
assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
|
||||
ctx.s.flags = MEM_Null;
|
||||
ctx.s.z = pMem->zShort;
|
||||
ctx.pMem = pMem;
|
||||
@@ -225,7 +225,7 @@ void sqlite3VdbeMemRelease(Mem *p){
|
||||
if( p->flags & (MEM_Dyn|MEM_Agg) ){
|
||||
if( p->xDel ){
|
||||
if( p->flags & MEM_Agg ){
|
||||
sqlite3VdbeMemFinalize(p, p->pDef);
|
||||
sqlite3VdbeMemFinalize(p, p->u.pDef);
|
||||
assert( (p->flags & MEM_Agg)==0 );
|
||||
sqlite3VdbeMemRelease(p);
|
||||
}else{
|
||||
@@ -252,7 +252,7 @@ void sqlite3VdbeMemRelease(Mem *p){
|
||||
i64 sqlite3VdbeIntValue(Mem *pMem){
|
||||
int flags = pMem->flags;
|
||||
if( flags & MEM_Int ){
|
||||
return pMem->i;
|
||||
return pMem->u.i;
|
||||
}else if( flags & MEM_Real ){
|
||||
return (i64)pMem->r;
|
||||
}else if( flags & (MEM_Str|MEM_Blob) ){
|
||||
@@ -279,7 +279,7 @@ double sqlite3VdbeRealValue(Mem *pMem){
|
||||
if( pMem->flags & MEM_Real ){
|
||||
return pMem->r;
|
||||
}else if( pMem->flags & MEM_Int ){
|
||||
return (double)pMem->i;
|
||||
return (double)pMem->u.i;
|
||||
}else if( pMem->flags & (MEM_Str|MEM_Blob) ){
|
||||
double val = 0.0;
|
||||
if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
|
||||
@@ -300,8 +300,8 @@ double sqlite3VdbeRealValue(Mem *pMem){
|
||||
*/
|
||||
void sqlite3VdbeIntegerAffinity(Mem *pMem){
|
||||
assert( pMem->flags & MEM_Real );
|
||||
pMem->i = pMem->r;
|
||||
if( ((double)pMem->i)==pMem->r ){
|
||||
pMem->u.i = pMem->r;
|
||||
if( ((double)pMem->u.i)==pMem->r ){
|
||||
pMem->flags |= MEM_Int;
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ void sqlite3VdbeIntegerAffinity(Mem *pMem){
|
||||
** Convert pMem to type integer. Invalidate any prior representations.
|
||||
*/
|
||||
int sqlite3VdbeMemIntegerify(Mem *pMem){
|
||||
pMem->i = sqlite3VdbeIntValue(pMem);
|
||||
pMem->u.i = sqlite3VdbeIntValue(pMem);
|
||||
sqlite3VdbeMemRelease(pMem);
|
||||
pMem->flags = MEM_Int;
|
||||
return SQLITE_OK;
|
||||
@@ -353,7 +353,7 @@ void sqlite3VdbeMemSetNull(Mem *pMem){
|
||||
*/
|
||||
void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
|
||||
sqlite3VdbeMemRelease(pMem);
|
||||
pMem->i = val;
|
||||
pMem->u.i = val;
|
||||
pMem->flags = MEM_Int;
|
||||
pMem->type = SQLITE_INTEGER;
|
||||
}
|
||||
@@ -538,12 +538,12 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
|
||||
if( (f1 & f2 & MEM_Int)==0 ){
|
||||
double r1, r2;
|
||||
if( (f1&MEM_Real)==0 ){
|
||||
r1 = pMem1->i;
|
||||
r1 = pMem1->u.i;
|
||||
}else{
|
||||
r1 = pMem1->r;
|
||||
}
|
||||
if( (f2&MEM_Real)==0 ){
|
||||
r2 = pMem2->i;
|
||||
r2 = pMem2->u.i;
|
||||
}else{
|
||||
r2 = pMem2->r;
|
||||
}
|
||||
@@ -553,8 +553,8 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
|
||||
}else{
|
||||
assert( f1&MEM_Int );
|
||||
assert( f2&MEM_Int );
|
||||
if( pMem1->i < pMem2->i ) return -1;
|
||||
if( pMem1->i > pMem2->i ) return 1;
|
||||
if( pMem1->u.i < pMem2->u.i ) return -1;
|
||||
if( pMem1->u.i > pMem2->u.i ) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -735,7 +735,7 @@ void sqlite3VdbeMemSanity(Mem *pMem){
|
||||
|| (pMem->flags&MEM_Null)==0 );
|
||||
/* If the MEM is both real and integer, the values are equal */
|
||||
assert( (pMem->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real)
|
||||
|| pMem->r==pMem->i );
|
||||
|| pMem->r==pMem->u.i );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -831,7 +831,7 @@ int sqlite3ValueFromExpr(
|
||||
}
|
||||
}else if( op==TK_UMINUS ) {
|
||||
if( SQLITE_OK==sqlite3ValueFromExpr(pExpr->pLeft, enc, affinity, &pVal) ){
|
||||
pVal->i = -1 * pVal->i;
|
||||
pVal->u.i = -1 * pVal->u.i;
|
||||
pVal->r = -1.0 * pVal->r;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user