aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2016-07-30 16:39:28 +0000
committerdan <dan@noemail.net>2016-07-30 16:39:28 +0000
commit625015e0c99a689eb362853c03123aa8eabd032e (patch)
tree6db1308853c1d4574c3a29cba332d3563a4a54c2 /src/expr.c
parent19ff12dd76b7b57cd9feed6298a399fc5d8f9cec (diff)
downloadsqlite-625015e0c99a689eb362853c03123aa8eabd032e.tar.gz
sqlite-625015e0c99a689eb362853c03123aa8eabd032e.zip
Remove the EP_Vector expression flag.
FossilOrigin-Name: e9d9c6d46b46160fad6aa6e3441a65a09157515f
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/expr.c b/src/expr.c
index 264f27dbf..5f5e1d058 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -316,7 +316,7 @@ static int codeCompare(
** any other type of expression, return 1.
*/
int sqlite3ExprVectorSize(Expr *pExpr){
- if( (pExpr->flags & EP_Vector)==0 ) return 1;
+ if( sqlite3ExprIsVector(pExpr)==0 ) return 1;
if( pExpr->flags & EP_xIsSelect ){
return pExpr->x.pSelect->pEList->nExpr;
}
@@ -324,13 +324,23 @@ int sqlite3ExprVectorSize(Expr *pExpr){
}
/*
+** Return true if expression pExpr is a vector, or false otherwise.
+*/
+int sqlite3ExprIsVector(Expr *pExpr){
+ return (
+ pExpr->op==TK_VECTOR
+ || (pExpr->op==TK_SELECT && pExpr->x.pSelect->pEList->nExpr>1)
+ );
+}
+
+/*
** 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
** points to a sub-select, return a pointer to the i'th returned column
** value. Otherwise, return a copy of the first argument.
*/
static Expr *exprVectorField(Expr *pVector, int i){
- if( (pVector->flags & EP_Vector)==0 ){
+ if( sqlite3ExprIsVector(pVector)==0 ){
assert( i==0 );
return pVector;
}else if( pVector->flags & EP_xIsSelect ){
@@ -3171,7 +3181,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
case TK_NE:
case TK_EQ: {
Expr *pLeft = pExpr->pLeft;
- if( (pLeft->flags & EP_Vector) ){
+ if( sqlite3ExprIsVector(pLeft) ){
codeVectorCompare(pParse, pExpr, target);
}else{
r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);
@@ -3865,7 +3875,7 @@ static void exprCodeBetween(
compRight.op = TK_LE;
compRight.pLeft = &exprX;
compRight.pRight = pExpr->x.pList->a[1].pExpr;
- if( (exprX.flags & EP_Vector)==0 ){
+ if( sqlite3ExprIsVector(&exprX)==0 ){
exprToRegister(&exprX, sqlite3ExprCodeTemp(pParse, &exprX, &regFree1));
}
if( xJumpIf ){
@@ -3949,7 +3959,7 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
case TK_GE:
case TK_NE:
case TK_EQ: {
- if( pExpr->pLeft->flags & EP_Vector ) goto default_expr;
+ if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
testcase( jumpIfNull==0 );
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
@@ -4103,8 +4113,7 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
case TK_GE:
case TK_NE:
case TK_EQ: {
- if( pExpr->pLeft->flags & EP_Vector ) goto default_expr;
-
+ if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
testcase( jumpIfNull==0 );
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);