diff options
author | drh <drh@noemail.net> | 2010-12-06 21:06:09 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-12-06 21:06:09 +0000 |
commit | f58ee7f1aa1ef87d2c493af096fa8ac72d762cf0 (patch) | |
tree | a689363e01fadad2e79844a7bb1bb19ad6046776 /src/expr.c | |
parent | ef4c0598438b409cc7367e7583a3aa01c16b3e3f (diff) | |
download | sqlite-f58ee7f1aa1ef87d2c493af096fa8ac72d762cf0.tar.gz sqlite-f58ee7f1aa1ef87d2c493af096fa8ac72d762cf0.zip |
Add the ability to disable constant factoring using sqlite3_test_control().
Add a TCL interface to this new capability and add tests cases to the TCL
test scripts to actually use the new capability.
FossilOrigin-Name: ad8bc68197f2b47435149c3dbc035f4e7210fc76
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c index 3a6ba9f3e..b902f451c 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3040,10 +3040,22 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){ ** Preevaluate constant subexpressions within pExpr and store the ** results in registers. Modify pExpr so that the constant subexpresions ** are TK_REGISTER opcodes that refer to the precomputed values. +** +** This routine is a no-op if the jump to the cookie-check code has +** already occur. Since the cookie-check jump is generated prior to +** any other serious processing, this check ensures that there is no +** way to accidently bypass the constant initializations. +** +** This routine is also a no-op if the SQLITE_FactorOutConst optimization +** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) +** interface. This allows test logic to verify that the same answer is +** obtained for queries regardless of whether or not constants are +** precomputed into registers or if they are inserted in-line. */ void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){ Walker w; if( pParse->cookieGoto ) return; + if( (pParse->db->flags & SQLITE_FactorOutConst)!=0 ) return; w.xExprCallback = evalConstExpr; w.xSelectCallback = 0; w.pParse = pParse; |