mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Change the meaning of the SQLITE_SUBTYPE flag so that it indicates that the user-defined function cares about the subtypes of its arguments.
FossilOrigin-Name: af1bc20f502816db460d2b2d353f715da5cf660e59095de5214c829c1cb20981
This commit is contained in:
28
src/window.c
28
src/window.c
@@ -868,32 +868,6 @@ static void selectWindowRewriteEList(
|
||||
*ppSub = sRewrite.pSub;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if the top-level of list pList contains an SQL function
|
||||
** with the SQLITE_FUNC_SUBTYPE flag set. Return false otherwise.
|
||||
*/
|
||||
int exprListContainsSubtype(Parse *pParse, ExprList *pList){
|
||||
if( pList ){
|
||||
sqlite3 *db = pParse->db;
|
||||
int i;
|
||||
for(i=0; i<pList->nExpr; i++){
|
||||
Expr *p = pList->a[i].pExpr;
|
||||
if( p->op==TK_FUNCTION ){
|
||||
FuncDef *pDef;
|
||||
int nArg = 0;
|
||||
if( !ExprHasProperty(p, EP_TokenOnly) && p->x.pList ){
|
||||
nArg = p->x.pList->nExpr;
|
||||
}
|
||||
pDef = sqlite3FindFunction(db, p->u.zToken, nArg, db->enc, 0);
|
||||
if( pDef && (pDef->funcFlags & SQLITE_FUNC_SUBTYPE) ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Append a copy of each expression in expression-list pAppend to
|
||||
** expression list pList. Return a pointer to the result list.
|
||||
@@ -992,7 +966,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
|
||||
** results. */
|
||||
for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
|
||||
ExprList *pArgs = pWin->pOwner->x.pList;
|
||||
if( exprListContainsSubtype(pParse, pArgs) ){
|
||||
if( pWin->pFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
|
||||
selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
|
||||
pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
|
||||
pWin->bExprArgs = 1;
|
||||
|
Reference in New Issue
Block a user