1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Factor out the common operation of setting the Expr.x.pSelect field of an

Expr object into a subroutine.

FossilOrigin-Name: 6a5cceee486c5e3625556e4c7076ff90e9d8fa43
This commit is contained in:
drh
2016-04-11 01:06:47 +00:00
parent ba26faa33f
commit 08de4f7933
6 changed files with 39 additions and 55 deletions

View File

@@ -562,6 +562,22 @@ Expr *sqlite3PExpr(
return p;
}
/*
** 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