1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add the new sqlite3ExprUnmapAndDelete() function and use it in place of

separate calls to sqlite3RenameExprUnmap() and sqlite3ExprDelete().

FossilOrigin-Name: 36ea13e0a851a749c9ef292377ecd82dbd4797d38df907b362487fa234c98ca5
This commit is contained in:
drh
2019-06-11 10:43:56 +00:00
parent b854b76733
commit 8e34e4061b
6 changed files with 27 additions and 21 deletions

View File

@@ -895,12 +895,8 @@ Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
}else if( pRight==0 ){
return pLeft;
}else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
if( IN_RENAME_OBJECT ){
sqlite3RenameExprUnmap(pParse, pLeft);
sqlite3RenameExprUnmap(pParse, pRight);
}
sqlite3ExprDelete(db, pLeft);
sqlite3ExprDelete(db, pRight);
sqlite3ExprUnmapAndDelete(pParse, pLeft);
sqlite3ExprUnmapAndDelete(pParse, pRight);
return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
}else{
return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
@@ -1060,6 +1056,18 @@ void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p ) sqlite3ExprDeleteNN(db, p);
}
/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
** expression.
*/
void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){
if( p ){
if( IN_RENAME_OBJECT ){
sqlite3RenameExprUnmap(pParse, p);
}
sqlite3ExprDeleteNN(pParse->db, p);
}
}
/*
** Return the number of bytes allocated for the expression structure
** passed as the first argument. This is always one of EXPR_FULLSIZE,
@@ -1642,10 +1650,7 @@ ExprList *sqlite3ExprListAppendVector(
}
vector_append_error:
if( IN_RENAME_OBJECT ){
sqlite3RenameExprUnmap(pParse, pExpr);
}
sqlite3ExprDelete(db, pExpr);
sqlite3ExprUnmapAndDelete(pParse, pExpr);
sqlite3IdListDelete(db, pColumns);
return pList;
}