aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-04-11 01:06:47 +0000
committerdrh <drh@noemail.net>2016-04-11 01:06:47 +0000
commit08de4f7933f9ae26e33b2367a5a8e802442d56b0 (patch)
tree18b0e51330ade3f11ac939d343e40fe1c059ca88 /src/expr.c
parentba26faa33f6cb9aa3ee5c2e4a42592a2fe840b23 (diff)
downloadsqlite-08de4f7933f9ae26e33b2367a5a8e802442d56b0.tar.gz
sqlite-08de4f7933f9ae26e33b2367a5a8e802442d56b0.zip
Factor out the common operation of setting the Expr.x.pSelect field of an
Expr object into a subroutine. FossilOrigin-Name: 6a5cceee486c5e3625556e4c7076ff90e9d8fa43
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 998c94f23..6792f26a5 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -563,6 +563,22 @@ Expr *sqlite3PExpr(
}
/*
+** Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due
+** do a memory allocation failure) then delete the pSelect object.
+*/
+void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){
+ if( pExpr ){
+ pExpr->x.pSelect = pSelect;
+ ExprSetProperty(pExpr, EP_xIsSelect|EP_Subquery);
+ sqlite3ExprSetHeightAndFlags(pParse, pExpr);
+ }else{
+ assert( pParse->db->mallocFailed );
+ sqlite3SelectDelete(pParse->db, pSelect);
+ }
+}
+
+
+/*
** If the expression is always either TRUE or FALSE (respectively),
** then return 1. If one cannot determine the truth value of the
** expression at compile-time return 0.