aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-06-11 13:58:35 +0000
committerdrh <drh@noemail.net>2015-06-11 13:58:35 +0000
commit72bc8208f01a8e476996db7c6de09ad61ed62d6f (patch)
tree19038f1b0c8116c3b1d33c9b6b974e211ecd0bd8 /src/expr.c
parent033eb6c8d3f4b9c3a0f9343bcb349fbad6ac0b66 (diff)
downloadsqlite-72bc8208f01a8e476996db7c6de09ad61ed62d6f.tar.gz
sqlite-72bc8208f01a8e476996db7c6de09ad61ed62d6f.zip
When generating code for partial indexes, be sure not to modify the
index condition expression in the schema. FossilOrigin-Name: e63d01c69c3e50f49ee3022a519c4f3e91f00520
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 89eee29ec..06993e737 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -3703,6 +3703,21 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
}
/*
+** Like sqlite3ExprIfFalse() except that a copy is made of pExpr before
+** code generation, and that copy is deleted after code generation. This
+** ensures that the original pExpr is unchanged.
+*/
+void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){
+ sqlite3 *db = pParse->db;
+ Expr *pCopy = sqlite3ExprDup(db, pExpr, 0);
+ if( db->mallocFailed==0 ){
+ sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull);
+ }
+ sqlite3ExprDelete(db, pCopy);
+}
+
+
+/*
** Do a deep comparison of two expression trees. Return 0 if the two
** expressions are completely identical. Return 1 if they differ only
** by a COLLATE operator at the top level. Return 2 if there are differences