mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Rework the FILTER clause implementation to share more code with window functions.
FossilOrigin-Name: 5dac8c38dfc3f41c5c8fb49ca35de7fd1b21f269d72e8ba6ba59ed0a4030a54d
This commit is contained in:
12
src/walker.c
12
src/walker.c
@@ -63,23 +63,19 @@ static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
|
||||
if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
|
||||
assert( pExpr->x.pList==0 || pExpr->pRight==0 );
|
||||
if( pExpr->pRight ){
|
||||
assert( !ExprHasProperty(pExpr, EP_WinFunc|EP_Filter) );
|
||||
assert( !ExprHasProperty(pExpr, EP_WinFunc) );
|
||||
pExpr = pExpr->pRight;
|
||||
continue;
|
||||
}else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
|
||||
assert( !ExprHasProperty(pExpr, EP_WinFunc|EP_Filter) );
|
||||
assert( !ExprHasProperty(pExpr, EP_WinFunc) );
|
||||
if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
|
||||
}else{
|
||||
if( pExpr->x.pList ){
|
||||
if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
|
||||
}
|
||||
#ifndef SQLITE_OMIT_WINDOWFUNC
|
||||
if( ExprHasProperty(pExpr, EP_WinFunc|EP_Filter) ){
|
||||
if( ExprHasProperty(pExpr, EP_WinFunc) ){
|
||||
if( walkWindowList(pWalker, pExpr->y.pWin) ) return WRC_Abort;
|
||||
}else if( ExprHasProperty(pExpr, EP_Filter) ){
|
||||
if( walkExpr(pWalker, pExpr->y.pFilter) ) return WRC_Abort;
|
||||
}
|
||||
if( ExprHasProperty(pExpr, EP_WinFunc) ){
|
||||
if( walkWindowList(pWalker, pExpr->y.pWin) ) return WRC_Abort;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user