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

Consolidate the removal of Window objects from the Select.pWin list into

a single subroutine.

FossilOrigin-Name: e46b2afc99329c43de08d4a2e6ade4d2239d7409c5d5626bf272a3e0dd24d1b4
This commit is contained in:
drh
2019-07-22 19:01:38 +00:00
parent e0ae3f69eb
commit e209457295
5 changed files with 25 additions and 19 deletions

View File

@@ -1017,15 +1017,24 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
return rc;
}
/*
** Unlink the Window object from the Select to which it is attached,
** if it is attached.
*/
void sqlite3WindowUnlinkFromSelect(Window *p){
if( p->ppThis ){
*p->ppThis = p->pNextWin;
if( p->pNextWin ) p->pNextWin->ppThis = p->ppThis;
p->ppThis = 0;
}
}
/*
** Free the Window object passed as the second argument.
*/
void sqlite3WindowDelete(sqlite3 *db, Window *p){
if( p ){
if( p->ppThis ){
*p->ppThis = p->pNextWin;
if( p->pNextWin ) p->pNextWin->ppThis = p->ppThis;
}
sqlite3WindowUnlinkFromSelect(p);
sqlite3ExprDelete(db, p->pFilter);
sqlite3ExprListDelete(db, p->pPartition);
sqlite3ExprListDelete(db, p->pOrderBy);