mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Various size optimizations. (CVS 1867)
FossilOrigin-Name: 1186e3ce0b660f1cf8d03a275b0331da64d21f1b
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Prepared\sstatements\snow\swork\swith\sCREATE\sand\sDROP.\s\sAll\stests\spass.\nNo\smemory\sleaks.\s(CVS\s1866)
|
C Various\ssize\soptimizations.\s(CVS\s1867)
|
||||||
D 2004-07-24T17:38:29
|
D 2004-07-26T00:31:09
|
||||||
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
|
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
|
||||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -29,11 +29,11 @@ F src/attach.c 784456629b3d7e50e4691f496700658fd1f16441
|
|||||||
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
|
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
|
||||||
F src/btree.c edf4ece708350dec7f28ebd4620c6d33afe6993a
|
F src/btree.c edf4ece708350dec7f28ebd4620c6d33afe6993a
|
||||||
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
|
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
|
||||||
F src/build.c 7d2981666b6d0c530766dbf1284aabc328e1ec71
|
F src/build.c d1a2d7a99bb07a1ea4a019fcef6786546cb09f73
|
||||||
F src/date.c e1bb384a7856c18dce9cadb0afbe6934ba5ddb00
|
F src/date.c e1bb384a7856c18dce9cadb0afbe6934ba5ddb00
|
||||||
F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3
|
F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3
|
||||||
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
||||||
F src/expr.c a4e8ac69c872f86bc207364be0e32d0638f61e90
|
F src/expr.c 0b8c89324d979895e6b0f31a6d7bf60edfee13ac
|
||||||
F src/func.c b163fb49efec999eb7bf982f7de5b9be388301f3
|
F src/func.c b163fb49efec999eb7bf982f7de5b9be388301f3
|
||||||
F src/hash.c f0a2f22c2a7052d67053b5f4690ea3010bb3fb9f
|
F src/hash.c f0a2f22c2a7052d67053b5f4690ea3010bb3fb9f
|
||||||
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
||||||
@@ -240,7 +240,7 @@ F www/tclsqlite.tcl 06a86cba4d7fc88e2bcd633b57702d3d16abebb5
|
|||||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 6db3f122aad25b5226670ce682b7263d55c0d301
|
P ebdb661e0eefe123c422d3c1c371e325bb6cf673
|
||||||
R 987e7be0c6defafac7646ce8c68bde8c
|
R b582908bbe936abff9e10f0211707e80
|
||||||
U drh
|
U drh
|
||||||
Z 4bf2f79f0d58a1ba844cc564cece29c1
|
Z 252f8c5e2aa916f947cdd3f9490bfe4a
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
ebdb661e0eefe123c422d3c1c371e325bb6cf673
|
1186e3ce0b660f1cf8d03a275b0331da64d21f1b
|
||||||
31
src/build.c
31
src/build.c
@@ -23,7 +23,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** PRAGMA
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.243 2004/07/24 17:38:29 drh Exp $
|
** $Id: build.c,v 1.244 2004/07/26 00:31:09 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1408,17 +1408,17 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){
|
|||||||
*/
|
*/
|
||||||
if( db->init.busy && pParse->nErr==0 ){
|
if( db->init.busy && pParse->nErr==0 ){
|
||||||
Table *pOld;
|
Table *pOld;
|
||||||
FKey *pFKey;
|
FKey *pFKey;
|
||||||
pOld = sqlite3HashInsert(&db->aDb[p->iDb].tblHash,
|
Db *pDb = &db->aDb[p->iDb];
|
||||||
p->zName, strlen(p->zName)+1, p);
|
pOld = sqlite3HashInsert(&pDb->tblHash, p->zName, strlen(p->zName)+1, p);
|
||||||
if( pOld ){
|
if( pOld ){
|
||||||
assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
|
assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(pFKey=p->pFKey; pFKey; pFKey=pFKey->pNextFrom){
|
for(pFKey=p->pFKey; pFKey; pFKey=pFKey->pNextFrom){
|
||||||
int nTo = strlen(pFKey->zTo) + 1;
|
int nTo = strlen(pFKey->zTo) + 1;
|
||||||
pFKey->pNextTo = sqlite3HashFind(&db->aDb[p->iDb].aFKey, pFKey->zTo, nTo);
|
pFKey->pNextTo = sqlite3HashFind(&pDb->aFKey, pFKey->zTo, nTo);
|
||||||
sqlite3HashInsert(&db->aDb[p->iDb].aFKey, pFKey->zTo, nTo, pFKey);
|
sqlite3HashInsert(&pDb->aFKey, pFKey->zTo, nTo, pFKey);
|
||||||
}
|
}
|
||||||
pParse->pNewTable = 0;
|
pParse->pNewTable = 0;
|
||||||
db->nTable++;
|
db->nTable++;
|
||||||
@@ -2403,17 +2403,18 @@ int sqlite3IdListIndex(IdList *pList, const char *zName){
|
|||||||
*/
|
*/
|
||||||
void sqlite3SrcListDelete(SrcList *pList){
|
void sqlite3SrcListDelete(SrcList *pList){
|
||||||
int i;
|
int i;
|
||||||
|
struct SrcList_item *pItem;
|
||||||
if( pList==0 ) return;
|
if( pList==0 ) return;
|
||||||
for(i=0; i<pList->nSrc; i++){
|
for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
|
||||||
sqliteFree(pList->a[i].zDatabase);
|
sqliteFree(pItem->zDatabase);
|
||||||
sqliteFree(pList->a[i].zName);
|
sqliteFree(pItem->zName);
|
||||||
sqliteFree(pList->a[i].zAlias);
|
sqliteFree(pItem->zAlias);
|
||||||
if( pList->a[i].pTab && pList->a[i].pTab->isTransient ){
|
if( pItem->pTab && pItem->pTab->isTransient ){
|
||||||
sqlite3DeleteTable(0, pList->a[i].pTab);
|
sqlite3DeleteTable(0, pItem->pTab);
|
||||||
}
|
}
|
||||||
sqlite3SelectDelete(pList->a[i].pSelect);
|
sqlite3SelectDelete(pItem->pSelect);
|
||||||
sqlite3ExprDelete(pList->a[i].pOn);
|
sqlite3ExprDelete(pItem->pOn);
|
||||||
sqlite3IdListDelete(pList->a[i].pUsing);
|
sqlite3IdListDelete(pItem->pUsing);
|
||||||
}
|
}
|
||||||
sqliteFree(pList);
|
sqliteFree(pList);
|
||||||
}
|
}
|
||||||
|
|||||||
119
src/expr.c
119
src/expr.c
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.152 2004/07/21 02:53:30 drh Exp $
|
** $Id: expr.c,v 1.153 2004/07/26 00:31:09 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -171,6 +171,22 @@ static CollSeq* binaryCompareCollSeq(Parse *pParse, Expr *pLeft, Expr *pRight){
|
|||||||
return pColl;
|
return pColl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Generate code for a comparison operator.
|
||||||
|
*/
|
||||||
|
static int codeCompare(
|
||||||
|
Parse *pParse, /* The parsing (and code generating) context */
|
||||||
|
Expr *pLeft, /* The left operand */
|
||||||
|
Expr *pRight, /* The right operand */
|
||||||
|
int opcode, /* The comparison opcode */
|
||||||
|
int dest, /* Jump here if true. */
|
||||||
|
int jumpIfNull /* If true, jump if either operand is NULL */
|
||||||
|
){
|
||||||
|
int p1 = binaryCompareP1(pLeft, pRight, jumpIfNull);
|
||||||
|
CollSeq *p3 = binaryCompareCollSeq(pParse, pLeft, pRight);
|
||||||
|
return sqlite3VdbeOp3(pParse->pVdbe, opcode, p1, dest, (void *)p3, P3_COLLSEQ);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Construct a new expression node and return a pointer to it. Memory
|
** Construct a new expression node and return a pointer to it. Memory
|
||||||
** for this node is obtained from sqliteMalloc(). The calling function
|
** for this node is obtained from sqliteMalloc(). The calling function
|
||||||
@@ -433,12 +449,13 @@ ExprList *sqlite3ExprListAppend(ExprList *pList, Expr *pExpr, Token *pName){
|
|||||||
*/
|
*/
|
||||||
void sqlite3ExprListDelete(ExprList *pList){
|
void sqlite3ExprListDelete(ExprList *pList){
|
||||||
int i;
|
int i;
|
||||||
|
struct ExprList_item *pItem;
|
||||||
if( pList==0 ) return;
|
if( pList==0 ) return;
|
||||||
assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
|
assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
|
||||||
assert( pList->nExpr<=pList->nAlloc );
|
assert( pList->nExpr<=pList->nAlloc );
|
||||||
for(i=0; i<pList->nExpr; i++){
|
for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
|
||||||
sqlite3ExprDelete(pList->a[i].pExpr);
|
sqlite3ExprDelete(pItem->pExpr);
|
||||||
sqliteFree(pList->a[i].zName);
|
sqliteFree(pItem->zName);
|
||||||
}
|
}
|
||||||
sqliteFree(pList->a);
|
sqliteFree(pList->a);
|
||||||
sqliteFree(pList);
|
sqliteFree(pList);
|
||||||
@@ -860,11 +877,13 @@ int sqlite3ExprResolveIds(
|
|||||||
** table allocated and opened above.
|
** table allocated and opened above.
|
||||||
*/
|
*/
|
||||||
int iParm = pExpr->iTable + (((int)affinity)<<16);
|
int iParm = pExpr->iTable + (((int)affinity)<<16);
|
||||||
|
ExprList *pEList;
|
||||||
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
|
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
|
||||||
sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0, 0);
|
sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0, 0);
|
||||||
if( pExpr->pSelect->pEList && pExpr->pSelect->pEList->nExpr>0 ){
|
pEList = pExpr->pSelect->pEList;
|
||||||
|
if( pEList && pEList->nExpr>0 ){
|
||||||
keyInfo.aColl[0] = binaryCompareCollSeq(pParse, pExpr->pLeft,
|
keyInfo.aColl[0] = binaryCompareCollSeq(pParse, pExpr->pLeft,
|
||||||
pExpr->pSelect->pEList->a[0].pExpr);
|
pEList->a[0].pExpr);
|
||||||
}
|
}
|
||||||
}else if( pExpr->pList ){
|
}else if( pExpr->pList ){
|
||||||
/* Case 2: expr IN (exprlist)
|
/* Case 2: expr IN (exprlist)
|
||||||
@@ -1152,11 +1171,9 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
case TK_GE:
|
case TK_GE:
|
||||||
case TK_NE:
|
case TK_NE:
|
||||||
case TK_EQ: {
|
case TK_EQ: {
|
||||||
int p1 = binaryCompareP1(pExpr->pLeft, pExpr->pRight, 0);
|
|
||||||
CollSeq *p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
|
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pExpr->pLeft);
|
||||||
sqlite3ExprCode(pParse, pExpr->pRight);
|
sqlite3ExprCode(pParse, pExpr->pRight);
|
||||||
sqlite3VdbeOp3(v, op, p1, 0, (void *)p3, P3_COLLSEQ);
|
codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_AND:
|
case TK_AND:
|
||||||
@@ -1281,19 +1298,18 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_BETWEEN: {
|
case TK_BETWEEN: {
|
||||||
int p1;
|
Expr *pLeft = pExpr->pLeft;
|
||||||
CollSeq *p3;
|
struct ExprList_item *pLItem = pExpr->pList->a;
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
Expr *pRight = pLItem->pExpr;
|
||||||
|
sqlite3ExprCode(pParse, pLeft);
|
||||||
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[0].pExpr);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[0].pExpr, 0);
|
codeCompare(pParse, pLeft, pRight, OP_Ge, 0, 0);
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[0].pExpr);
|
|
||||||
sqlite3VdbeOp3(v, OP_Ge, p1, 0, (void *)p3, P3_COLLSEQ);
|
|
||||||
sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
|
sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[1].pExpr);
|
pLItem++;
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[1].pExpr, 0);
|
pRight = pLItem->pExpr;
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[1].pExpr);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
sqlite3VdbeOp3(v, OP_Le, p1, 0, (void *)p3, P3_COLLSEQ);
|
codeCompare(pParse, pLeft, pRight, OP_Le, 0, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_And, 0, 0);
|
sqlite3VdbeAddOp(v, OP_And, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1308,28 +1324,30 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
int addr;
|
int addr;
|
||||||
int nExpr;
|
int nExpr;
|
||||||
int i;
|
int i;
|
||||||
|
ExprList *pEList;
|
||||||
|
struct ExprList_item *aListelem;
|
||||||
|
|
||||||
assert(pExpr->pList);
|
assert(pExpr->pList);
|
||||||
assert((pExpr->pList->nExpr % 2) == 0);
|
assert((pExpr->pList->nExpr % 2) == 0);
|
||||||
assert(pExpr->pList->nExpr > 0);
|
assert(pExpr->pList->nExpr > 0);
|
||||||
nExpr = pExpr->pList->nExpr;
|
pEList = pExpr->pList;
|
||||||
|
aListelem = pEList->a;
|
||||||
|
nExpr = pEList->nExpr;
|
||||||
expr_end_label = sqlite3VdbeMakeLabel(v);
|
expr_end_label = sqlite3VdbeMakeLabel(v);
|
||||||
if( pExpr->pLeft ){
|
if( pExpr->pLeft ){
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pExpr->pLeft);
|
||||||
}
|
}
|
||||||
for(i=0; i<nExpr; i=i+2){
|
for(i=0; i<nExpr; i=i+2){
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[i].pExpr);
|
sqlite3ExprCode(pParse, aListelem[i].pExpr);
|
||||||
if( pExpr->pLeft ){
|
if( pExpr->pLeft ){
|
||||||
int p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[i].pExpr, 1);
|
|
||||||
CollSeq *p3 = binaryCompareCollSeq(pParse, pExpr->pLeft,
|
|
||||||
pExpr->pList->a[i].pExpr);
|
|
||||||
sqlite3VdbeAddOp(v, OP_Dup, 1, 1);
|
sqlite3VdbeAddOp(v, OP_Dup, 1, 1);
|
||||||
jumpInst = sqlite3VdbeOp3(v, OP_Ne, p1, 0, (void *)p3, P3_COLLSEQ);
|
jumpInst = codeCompare(pParse, pExpr->pLeft, aListelem[i].pExpr,
|
||||||
|
OP_Ne, 0, 1);
|
||||||
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
|
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
|
||||||
}else{
|
}else{
|
||||||
jumpInst = sqlite3VdbeAddOp(v, OP_IfNot, 1, 0);
|
jumpInst = sqlite3VdbeAddOp(v, OP_IfNot, 1, 0);
|
||||||
}
|
}
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[i+1].pExpr);
|
sqlite3ExprCode(pParse, aListelem[i+1].pExpr);
|
||||||
sqlite3VdbeAddOp(v, OP_Goto, 0, expr_end_label);
|
sqlite3VdbeAddOp(v, OP_Goto, 0, expr_end_label);
|
||||||
addr = sqlite3VdbeCurrentAddr(v);
|
addr = sqlite3VdbeCurrentAddr(v);
|
||||||
sqlite3VdbeChangeP2(v, jumpInst, addr);
|
sqlite3VdbeChangeP2(v, jumpInst, addr);
|
||||||
@@ -1436,11 +1454,9 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
case TK_GE:
|
case TK_GE:
|
||||||
case TK_NE:
|
case TK_NE:
|
||||||
case TK_EQ: {
|
case TK_EQ: {
|
||||||
int p1 = binaryCompareP1(pExpr->pLeft, pExpr->pRight, jumpIfNull);
|
|
||||||
CollSeq *p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
|
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pExpr->pLeft);
|
||||||
sqlite3ExprCode(pParse, pExpr->pRight);
|
sqlite3ExprCode(pParse, pExpr->pRight);
|
||||||
sqlite3VdbeOp3(v, op, p1, dest, (void *)p3, P3_COLLSEQ);
|
codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, dest, jumpIfNull);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_ISNULL:
|
case TK_ISNULL:
|
||||||
@@ -1457,19 +1473,16 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
** 3 ...
|
** 3 ...
|
||||||
*/
|
*/
|
||||||
int addr;
|
int addr;
|
||||||
int p1;
|
Expr *pLeft = pExpr->pLeft;
|
||||||
CollSeq *p3;
|
Expr *pRight = pExpr->pList->a[0].pExpr;
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pLeft);
|
||||||
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[0].pExpr);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[0].pExpr, !jumpIfNull);
|
addr = codeCompare(pParse, pLeft, pRight, OP_Lt, 0, !jumpIfNull);
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[0].pExpr);
|
|
||||||
addr = sqlite3VdbeOp3(v, OP_Lt, p1, 0, (void *)p3, P3_COLLSEQ);
|
|
||||||
|
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[1].pExpr);
|
pRight = pExpr->pList->a[1].pExpr;
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[1].pExpr, jumpIfNull);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[1].pExpr);
|
codeCompare(pParse, pLeft, pRight, OP_Le, dest, jumpIfNull);
|
||||||
sqlite3VdbeOp3(v, OP_Le, p1, dest, (void *)p3, P3_COLLSEQ);
|
|
||||||
|
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
|
||||||
sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
|
sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
|
||||||
@@ -1530,11 +1543,9 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
case TK_GE:
|
case TK_GE:
|
||||||
case TK_NE:
|
case TK_NE:
|
||||||
case TK_EQ: {
|
case TK_EQ: {
|
||||||
int p1 = binaryCompareP1(pExpr->pLeft, pExpr->pRight, jumpIfNull);
|
|
||||||
CollSeq *p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
|
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pExpr->pLeft);
|
||||||
sqlite3ExprCode(pParse, pExpr->pRight);
|
sqlite3ExprCode(pParse, pExpr->pRight);
|
||||||
sqlite3VdbeOp3(v, op, p1, dest, (void *)p3, P3_COLLSEQ);
|
codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, dest, jumpIfNull);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_ISNULL:
|
case TK_ISNULL:
|
||||||
@@ -1551,21 +1562,19 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
** 3 IF (x > z) GOTO <dest>
|
** 3 IF (x > z) GOTO <dest>
|
||||||
*/
|
*/
|
||||||
int addr;
|
int addr;
|
||||||
int p1;
|
Expr *pLeft = pExpr->pLeft;
|
||||||
CollSeq *p3;
|
Expr *pRight = pExpr->pList->a[0].pExpr;
|
||||||
sqlite3ExprCode(pParse, pExpr->pLeft);
|
sqlite3ExprCode(pParse, pLeft);
|
||||||
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[0].pExpr);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
addr = sqlite3VdbeCurrentAddr(v);
|
addr = sqlite3VdbeCurrentAddr(v);
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[0].pExpr, !jumpIfNull);
|
codeCompare(pParse, pLeft, pRight, OP_Ge, addr+3, !jumpIfNull);
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[0].pExpr);
|
|
||||||
sqlite3VdbeOp3(v, OP_Ge, p1, addr+3, (void *)p3, P3_COLLSEQ);
|
|
||||||
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
|
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_Goto, 0, dest);
|
sqlite3VdbeAddOp(v, OP_Goto, 0, dest);
|
||||||
sqlite3ExprCode(pParse, pExpr->pList->a[1].pExpr);
|
pRight = pExpr->pList->a[1].pExpr;
|
||||||
p1 = binaryCompareP1(pExpr->pLeft, pExpr->pList->a[1].pExpr, jumpIfNull);
|
sqlite3ExprCode(pParse, pRight);
|
||||||
p3 = binaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pList->a[1].pExpr);
|
codeCompare(pParse, pLeft, pRight, OP_Gt, dest, jumpIfNull);
|
||||||
sqlite3VdbeOp3(v, OP_Gt, p1, dest, (void *)p3, P3_COLLSEQ);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
Reference in New Issue
Block a user