diff options
author | dan <dan@noemail.net> | 2016-08-02 17:45:00 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-08-02 17:45:00 +0000 |
commit | f9b2e05c75e55ca795caa825bfcba1c0760ea35f (patch) | |
tree | af04e7fbee05617f78c086013fcd27d1f253e7ad /src | |
parent | d05a7144cd7bcdbe5f5274198198e5120e846703 (diff) | |
download | sqlite-f9b2e05c75e55ca795caa825bfcba1c0760ea35f.tar.gz sqlite-f9b2e05c75e55ca795caa825bfcba1c0760ea35f.zip |
Fix SQLITE_OMIT_SUBQUERY builds.
FossilOrigin-Name: 339f85f414a484e44d2502d1ff7281caf9b7c838
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 8 | ||||
-rw-r--r-- | src/sqliteInt.h | 7 | ||||
-rw-r--r-- | src/wherecode.c | 20 |
3 files changed, 27 insertions, 8 deletions
diff --git a/src/expr.c b/src/expr.c index 53c00952f..c469b463e 100644 --- a/src/expr.c +++ b/src/expr.c @@ -332,6 +332,7 @@ int sqlite3ExprVectorSize(Expr *pExpr){ return pExpr->x.pList->nExpr; } +#ifndef SQLITE_OMIT_SUBQUERY /* ** If the expression passed as the first argument is a TK_VECTOR, return ** a pointer to the i'th field of the vector. Or, if the first argument @@ -350,6 +351,7 @@ static Expr *exprVectorField(Expr *pVector, int i){ } return pVector; } +#endif /* ** If expression pExpr is of type TK_SELECT, generate code to evaluate @@ -361,9 +363,11 @@ static Expr *exprVectorField(Expr *pVector, int i){ */ static int exprCodeSubselect(Parse *pParse, Expr *pExpr){ int reg = 0; +#ifndef SQLITE_OMIT_SUBQUERY if( pExpr->op==TK_SELECT ){ reg = sqlite3CodeSubselect(pParse, pExpr, 0, 0); } +#endif return reg; } @@ -1829,6 +1833,7 @@ int sqlite3CodeOnce(Parse *pParse){ return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++); } +#ifndef SQLITE_OMIT_SUBQUERY /* ** Generate code that checks the left-most column of index table iCur to see if ** it contains any NULL entries. Cause the register at regHasNull to be set @@ -1844,6 +1849,7 @@ static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ VdbeComment((v, "first_entry_in(%d)", iCur)); sqlite3VdbeJumpHere(v, addr1); } +#endif #ifndef SQLITE_OMIT_SUBQUERY @@ -2130,6 +2136,7 @@ int sqlite3FindInIndex( } #endif +#ifndef SQLITE_OMIT_SUBQUERY /* ** Argument pExpr is an (?, ?...) IN(...) expression. This ** function allocates and returns a nul-terminated string containing @@ -2161,6 +2168,7 @@ static char *exprINAffinity(Parse *pParse, Expr *pExpr){ } return zRet; } +#endif #ifndef SQLITE_OMIT_SUBQUERY /* diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 4c91d4657..56da61a2a 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3944,7 +3944,6 @@ int sqlite3GetToken(const unsigned char *, int *); void sqlite3NestedParse(Parse*, const char*, ...); void sqlite3ExpirePreparedStatements(sqlite3*); int sqlite3CodeSubselect(Parse*, Expr *, int, int); -int sqlite3ExprCheckIN(Parse*, Expr*); void sqlite3SelectPrep(Parse*, Select*, NameContext*); void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); @@ -3999,6 +3998,12 @@ Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); void sqlite3BackupRestart(sqlite3_backup *); void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); +#ifndef SQLITE_OMIT_SUBQUERY +int sqlite3ExprCheckIN(Parse*, Expr*); +#else +# define sqlite3ExprCheckIN(x,y) SQLITE_OK +#endif + #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 void sqlite3AnalyzeFunctions(void); int sqlite3Stat4ProbeSetValue(Parse*,Index*,UnpackedRecord**,Expr*,u8,int,int*); diff --git a/src/wherecode.c b/src/wherecode.c index 11e9bbda3..9aafa8366 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -360,6 +360,7 @@ static int codeEqualityTerm( assert( iTarget>0 ); if( pX->op==TK_EQ || pX->op==TK_IS ){ Expr *pRight = pX->pRight; +#ifndef SQLITE_OMIT_SUBQUERY if( pRight->op==TK_SELECT_COLUMN ){ /* This case occurs for expressions like "(a, b) == (SELECT ...)". */ WhereLoop *pLoop = pLevel->pWLoop; @@ -381,7 +382,9 @@ static int codeEqualityTerm( } } iReg = iTarget; - }else{ + }else +#endif + { iReg = sqlite3ExprCodeTarget(pParse, pRight, iTarget); } }else if( pX->op==TK_ISNULL ){ @@ -962,17 +965,20 @@ static void codeDeferredSeek( static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ assert( nReg>0 ); if( sqlite3ExprIsVector(p) ){ - int i; - if( (p->flags & EP_xIsSelect)==0 ){ +#ifndef SQLITE_OMIT_SUBQUERY + if( (p->flags & EP_xIsSelect) ){ + Vdbe *v = pParse->pVdbe; + int iSelect = sqlite3CodeSubselect(pParse, p, 0, 0); + sqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1); + }else +#endif + { + int i; ExprList *pList = p->x.pList; assert( nReg<=pList->nExpr ); for(i=0; i<nReg; i++){ sqlite3ExprCode(pParse, pList->a[i].pExpr, iReg+i); } - }else{ - Vdbe *v = pParse->pVdbe; - int iSelect = sqlite3CodeSubselect(pParse, p, 0, 0); - sqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1); } }else{ assert( nReg==1 ); |