mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Merge trunk changes into this branch.
FossilOrigin-Name: db1e60800bc260cdcd604739daaba72c6b486158123fc62a3898aca4ead33cd3
This commit is contained in:
21
src/window.c
21
src/window.c
@@ -1229,6 +1229,25 @@ void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Possibly link window pWin into the list at pSel->pWin (window functions
|
||||
** to be processed as part of SELECT statement pSel). The window is linked
|
||||
** in if either (a) there are no other windows already linked to this
|
||||
** SELECT, or (b) the windows already linked use a compatible window frame.
|
||||
*/
|
||||
void sqlite3WindowLink(Select *pSel, Window *pWin){
|
||||
if( 0==pSel->pWin
|
||||
|| 0==sqlite3WindowCompare(0, pSel->pWin, pWin, 0)
|
||||
){
|
||||
pWin->pNextWin = pSel->pWin;
|
||||
if( pSel->pWin ){
|
||||
pSel->pWin->ppThis = &pWin->pNextWin;
|
||||
}
|
||||
pSel->pWin = pWin;
|
||||
pWin->ppThis = &pSel->pWin;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Return 0 if the two window objects are identical, or non-zero otherwise.
|
||||
** Identical window objects can be processed in a single scan.
|
||||
@@ -1416,6 +1435,8 @@ static void windowAggStep(
|
||||
int nArg = windowArgCount(pWin);
|
||||
int i;
|
||||
|
||||
assert( bInverse==0 || pWin->eStart!=TK_UNBOUNDED );
|
||||
|
||||
for(i=0; i<nArg; i++){
|
||||
if( i!=1 || pFunc->zName!=nth_valueName ){
|
||||
sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+i, reg+i);
|
||||
|
Reference in New Issue
Block a user