diff options
author | drh <drh@noemail.net> | 2013-12-07 23:35:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-12-07 23:35:21 +0000 |
commit | 5b88bc4bec6a66d61d1819a69f2c306e3d328e03 (patch) | |
tree | 4a003ae80d0078e7056a9065422718f5dd6379ef /src/expr.c | |
parent | 28935364ef9c2aa4844c66592f28325a5eaf4d0c (diff) | |
download | sqlite-5b88bc4bec6a66d61d1819a69f2c306e3d328e03.tar.gz sqlite-5b88bc4bec6a66d61d1819a69f2c306e3d328e03.zip |
Do not allow cursor hints to use expressions containing subqueries. This
change fixes the problem seen in the previous check-in.
FossilOrigin-Name: bfefc57554853e467ee6aeaba8d08331406fa216
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c index 6c8a8cce7..8601d4a9b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1264,6 +1264,22 @@ int sqlite3ExprIsConstantOrFunction(Expr *p){ return exprIsConst(p, 2); } +#ifdef SQLITE_ENABLE_CURSOR_HINTS +/* +** Walk an expression tree. Return 1 if the expression contains a +** subquery of some kind. Return 0 if there are no subqueries. +*/ +int sqlite3ExprContainsSubquery(Expr *p){ + Walker w; + memset(&w, 0, sizeof(w)); + w.u.i = 1; + w.xExprCallback = sqlite3ExprWalkNoop; + w.xSelectCallback = selectNodeIsConstant; + sqlite3WalkExpr(&w, p); + return w.u.i==0; +} +#endif + /* ** If the expression p codes a constant integer that is small enough ** to fit in a 32-bit integer, return 1 and put the value of the integer |