diff options
author | dan <dan@noemail.net> | 2018-06-22 20:51:35 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2018-06-22 20:51:35 +0000 |
commit | 67a9b8eded051b514db853d53746f484f87bc23b (patch) | |
tree | cc14e3517ed605657b00b8278d520abd81051c01 /src | |
parent | 17074e3a9e1ab157fc37a361e2a4adc43d00e866 (diff) | |
download | sqlite-67a9b8eded051b514db853d53746f484f87bc23b.tar.gz sqlite-67a9b8eded051b514db853d53746f484f87bc23b.zip |
Omit all window-function related code when building with SQLITE_OMIT_WINDOWFUNC.
FossilOrigin-Name: 5f04b016467342b5a796bf702ed25b621eb86f2961c1e703d276c93f2cb6aa89
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 2 | ||||
-rw-r--r-- | src/btree.h | 2 | ||||
-rw-r--r-- | src/expr.c | 14 | ||||
-rw-r--r-- | src/func.c | 16 | ||||
-rw-r--r-- | src/parse.y | 22 | ||||
-rw-r--r-- | src/resolve.c | 11 | ||||
-rw-r--r-- | src/select.c | 28 | ||||
-rw-r--r-- | src/sqliteInt.h | 10 | ||||
-rw-r--r-- | src/test_config.c | 6 | ||||
-rw-r--r-- | src/vdbe.c | 19 | ||||
-rw-r--r-- | src/vdbeInt.h | 2 | ||||
-rw-r--r-- | src/vdbemem.c | 2 | ||||
-rw-r--r-- | src/window.c | 3 |
13 files changed, 116 insertions, 21 deletions
diff --git a/src/btree.c b/src/btree.c index 35e13478b..d2c580d11 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5190,12 +5190,14 @@ int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ ** Otherwise, if pCur is valid, configure it so that the next call to ** sqlite3BtreeNext() is a no-op. */ +#ifndef SQLITE_OMIT_WINDOWFUNC void sqlite3BtreeSkipNext(BtCursor *pCur){ if( pCur->eState==CURSOR_VALID ){ pCur->eState = CURSOR_SKIPNEXT; pCur->skipNext = 1; } } +#endif /* SQLITE_OMIT_WINDOWFUNC */ /* Move the cursor to the last entry in the table. Return SQLITE_OK ** on success. Set *pRes to 0 if the cursor actually points to something diff --git a/src/btree.h b/src/btree.h index 0b9784979..f6cf55bad 100644 --- a/src/btree.h +++ b/src/btree.h @@ -301,7 +301,9 @@ struct BtreePayload { int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, int flags, int seekResult); int sqlite3BtreeFirst(BtCursor*, int *pRes); +#ifndef SQLITE_OMIT_WINDOWFUNC void sqlite3BtreeSkipNext(BtCursor*); +#endif int sqlite3BtreeLast(BtCursor*, int *pRes); int sqlite3BtreeNext(BtCursor*, int flags); int sqlite3BtreeEof(BtCursor*); diff --git a/src/expr.c b/src/expr.c index 196942673..24d1cb410 100644 --- a/src/expr.c +++ b/src/expr.c @@ -772,7 +772,6 @@ Expr *sqlite3ExprAlloc( memset(pNew, 0, sizeof(Expr)); pNew->op = (u8)op; pNew->iAgg = -1; - pNew->pWin = 0; if( pToken ){ if( nExtra==0 ){ pNew->flags |= EP_IntValue|EP_Leaf; @@ -862,7 +861,6 @@ Expr *sqlite3PExpr( memset(p, 0, sizeof(Expr)); p->op = op & TKFLG_MASK; p->iAgg = -1; - p->pWin = 0; } sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); } @@ -1128,7 +1126,11 @@ static int dupedExprStructSize(Expr *p, int flags){ assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */ assert( EXPR_FULLSIZE<=0xfff ); assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 ); - if( 0==flags || p->op==TK_SELECT_COLUMN || p->pWin ){ + if( 0==flags || p->op==TK_SELECT_COLUMN +#ifndef SQLITE_OMIT_WINDOWFUNC + || p->pWin +#endif + ){ nSize = EXPR_FULLSIZE; }else{ assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); @@ -1268,11 +1270,13 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ *pzBuffer = zAlloc; } }else{ +#ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_Reduced|EP_TokenOnly) ){ pNew->pWin = 0; }else{ pNew->pWin = sqlite3WindowDup(db, pNew, p->pWin); } +#endif /* SQLITE_OMIT_WINDOWFUNC */ if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ if( pNew->op==TK_SELECT_COLUMN ){ pNew->pLeft = p->pLeft; @@ -1479,8 +1483,10 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ pNew->addrOpenEphm[1] = -1; pNew->nSelectRow = p->nSelectRow; pNew->pWith = withDup(db, p->pWith); +#ifndef SQLITE_OMIT_WINDOWFUNC pNew->pWin = 0; pNew->pWinDefn = sqlite3WindowListDup(db, p->pWinDefn); +#endif sqlite3SelectSetName(pNew, p->zSelName); *pp = pNew; pp = &pNew->pPrior; @@ -3800,9 +3806,11 @@ expr_code_doover: u8 enc = ENC(db); /* The text encoding used by this database */ CollSeq *pColl = 0; /* A collating sequence */ +#ifndef SQLITE_OMIT_WINDOWFUNC if( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) && pExpr->pWin ){ return pExpr->pWin->regResult; } +#endif if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){ /* SQL functions can be expensive. So try to move constant functions diff --git a/src/func.c b/src/func.c index 57a1f0ff4..c5dd6a58e 100644 --- a/src/func.c +++ b/src/func.c @@ -1513,6 +1513,7 @@ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ } } } +#ifndef SQLITE_OMIT_WINDOWFUNC static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){ SumCtx *p; int type; @@ -1534,6 +1535,9 @@ static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){ } } } +#else +# define sumInverse 0 +#endif /* SQLITE_OMIT_WINDOWFUNC */ static void sumFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); @@ -1646,9 +1650,13 @@ static void minMaxValueFinalize(sqlite3_context *context, int bValue){ if( bValue==0 ) sqlite3VdbeMemRelease(pRes); } } +#ifndef SQLITE_OMIT_WINDOWFUNC static void minMaxValue(sqlite3_context *context){ return minMaxValueFinalize(context, 1); } +#else +# define minMaxValue 0 +#endif /* SQLITE_OMIT_WINDOWFUNC */ static void minMaxFinalize(sqlite3_context *context){ return minMaxValueFinalize(context, 0); } @@ -1688,6 +1696,7 @@ static void groupConcatStep( if( zVal ) sqlite3_str_append(pAccum, zVal, nVal); } } +#ifndef SQLITE_OMIT_WINDOWFUNC static void groupConcatInverse( sqlite3_context *context, int argc, @@ -1712,6 +1721,9 @@ static void groupConcatInverse( if( pAccum->nChar==0 ) pAccum->mxAlloc = 0; } } +#else +# define groupConcatInverse 0 +#endif /* SQLITE_OMIT_WINDOWFUNC */ static void groupConcatFinalize(sqlite3_context *context){ StrAccum *pAccum; pAccum = sqlite3_aggregate_context(context, 0); @@ -1726,6 +1738,7 @@ static void groupConcatFinalize(sqlite3_context *context){ } } } +#ifndef SQLITE_OMIT_WINDOWFUNC static void groupConcatValue(sqlite3_context *context){ sqlite3_str *pAccum; pAccum = (sqlite3_str*)sqlite3_aggregate_context(context, 0); @@ -1740,6 +1753,9 @@ static void groupConcatValue(sqlite3_context *context){ } } } +#else +# define groupConcatValue 0 +#endif /* SQLITE_OMIT_WINDOWFUNC */ /* ** This routine does per-connection function registration. Most diff --git a/src/parse.y b/src/parse.y index d28ffc3fc..b25348058 100644 --- a/src/parse.y +++ b/src/parse.y @@ -529,17 +529,22 @@ multiselect_op(A) ::= UNION ALL. {A = TK_ALL;} multiselect_op(A) ::= EXCEPT|INTERSECT(OP). {A = @OP; /*A-overwrites-OP*/} %endif SQLITE_OMIT_COMPOUND_SELECT oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y) - groupby_opt(P) having_opt(Q) windowdefn_opt(R) + groupby_opt(P) having_opt(Q) +%ifndef SQLITE_OMIT_WINDOWFUNC + windowdefn_opt(R) +%endif orderby_opt(Z) limit_opt(L). { #if SELECTTRACE_ENABLED Token s = S; /*A-overwrites-S*/ #endif A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L); +#ifndef SQLITE_OMIT_WINDOWFUNC if( A ){ A->pWinDefn = R; }else{ sqlite3WindowListDelete(pParse->db, R); } +#endif // SQLITE_OMIT_WINDOWFUNC #if SELECTTRACE_ENABLED /* Populate the Select.zSelName[] string that is used to help with ** query planner debugging, to differentiate between multiple Select @@ -1011,7 +1016,11 @@ expr(A) ::= CAST LP expr(E) AS typetoken(T) RP. { sqlite3ExprAttachSubtrees(pParse->db, A, E, 0); } %endif SQLITE_OMIT_CAST -expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP over_opt(Z). { +expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP +%ifndef SQLITE_OMIT_WINDOWFUNC + over_opt(Z) +%endif +. { if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X); } @@ -1021,7 +1030,11 @@ expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP over_opt(Z). { A->flags |= EP_Distinct; } } -expr(A) ::= id(X) LP STAR RP over_opt(Z). { +expr(A) ::= id(X) LP STAR RP +%ifndef SQLITE_OMIT_WINDOWFUNC + over_opt(Z) +%endif +. { A = sqlite3ExprFunction(pParse, 0, &X); sqlite3WindowAttach(pParse, A, Z); } @@ -1029,6 +1042,8 @@ term(A) ::= CTIME_KW(OP). { A = sqlite3ExprFunction(pParse, 0, &OP); } +%ifndef SQLITE_OMIT_WINDOWFUNC + %type windowdefn_opt {Window*} %destructor windowdefn_opt {sqlite3WindowDelete(pParse->db, $$);} windowdefn_opt(A) ::= . { A = 0; } @@ -1121,6 +1136,7 @@ frame_bound(A) ::= CURRENT ROW. { A.eType = TK_CURRENT ; A.pExpr = 0; } frame_bound(A) ::= expr(X) FOLLOWING. { A.eType = TK_FOLLOWING; A.pExpr = X; } frame_bound(A) ::= UNBOUNDED FOLLOWING. { A.eType = TK_UNBOUNDED; A.pExpr = 0; } +%endif // SQLITE_OMIT_WINDOWFUNC expr(A) ::= LP nexprlist(X) COMMA expr(Y) RP. { ExprList *pList = sqlite3ExprListAppend(pParse, X, Y); diff --git a/src/resolve.c b/src/resolve.c index 221564f9d..84ec6598e 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -757,6 +757,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } } +#ifndef SQLITE_OMIT_WINDOWFUNC if( is_agg==0 && pExpr->pWin ){ sqlite3ErrorMsg(pParse, "%.*s() may not be used as a window function", nId, zId @@ -773,6 +774,10 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ }else{ zType = "aggregate"; } +#else + if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ + const char *zType = "aggregate"; +#endif sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()", zType, nId,zId); pNC->nErr++; is_agg = 0; @@ -791,6 +796,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg; sqlite3WalkExprList(pWalker, pList); if( is_agg ){ +#ifndef SQLITE_OMIT_WINDOWFUNC if( pExpr->pWin ){ Select *pSel = pNC->pWinSelect; sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->pWin, pDef); @@ -800,7 +806,9 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ pExpr->pWin->pNextWin = pSel->pWin; pSel->pWin = pExpr->pWin; } - }else{ + }else +#endif /* SQLITE_OMIT_WINDOWFUNC */ + { NameContext *pNC2 = pNC; pExpr->op = TK_AGG_FUNCTION; pExpr->op2 = 0; @@ -1264,7 +1272,6 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ nCompound = 0; pLeftmost = p; while( p ){ - assert( p->pWin==0 ); assert( (p->selFlags & SF_Expanded)!=0 ); assert( (p->selFlags & SF_Resolved)==0 ); p->selFlags |= SF_Resolved; diff --git a/src/select.c b/src/select.c index 2c0750408..43228b65f 100644 --- a/src/select.c +++ b/src/select.c @@ -96,9 +96,11 @@ static void clearSelect(sqlite3 *db, Select *p, int bFree){ sqlite3ExprDelete(db, p->pHaving); sqlite3ExprListDelete(db, p->pOrderBy); sqlite3ExprDelete(db, p->pLimit); +#ifndef SQLITE_OMIT_WINDOWFUNC if( OK_IF_ALWAYS_TRUE(p->pWinDefn) ){ sqlite3WindowListDelete(db, p->pWinDefn); } +#endif if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith); if( bFree ) sqlite3DbFreeNN(db, p); p = pPrior; @@ -165,8 +167,10 @@ Select *sqlite3SelectNew( pNew->pNext = 0; pNew->pLimit = pLimit; pNew->pWith = 0; +#ifndef SQLITE_OMIT_WINDOWFUNC pNew->pWin = 0; pNew->pWinDefn = 0; +#endif if( pParse->db->mallocFailed ) { clearSelect(pParse->db, pNew, pNew!=&standin); pNew = 0; @@ -3720,7 +3724,9 @@ static int flattenSubquery( pSub = pSubitem->pSelect; assert( pSub!=0 ); +#ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */ +#endif pSubSrc = pSub->pSrc; assert( pSubSrc ); @@ -5487,7 +5493,8 @@ int sqlite3Select( generateColumnNames(pParse, p); } - if( (rc = sqlite3WindowRewrite(pParse, p)) ){ +#ifndef SQLITE_OMIT_WINDOWFUNC + if( sqlite3WindowRewrite(pParse, p) ){ goto select_end; } #if SELECTTRACE_ENABLED @@ -5496,6 +5503,7 @@ int sqlite3Select( sqlite3TreeViewSelect(0, p, 0); } #endif +#endif /* SQLITE_OMIT_WINDOWFUNC */ pTabList = p->pSrc; isAgg = (p->selFlags & SF_Aggregate)!=0; @@ -5873,16 +5881,17 @@ int sqlite3Select( } if( !isAgg && pGroupBy==0 ){ - Window *pWin = p->pWin; /* Master window object (or NULL) */ - /* No aggregate functions and no GROUP BY clause */ - u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0); - assert( WHERE_USE_LIMIT==SF_FixedLimit ); - wctrlFlags |= p->selFlags & SF_FixedLimit; - + u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0) + | (p->selFlags & SF_FixedLimit); +#ifndef SQLITE_OMIT_WINDOWFUNC + Window *pWin = p->pWin; /* Master window object (or NULL) */ if( pWin ){ sqlite3WindowCodeInit(pParse, pWin); } +#endif + assert( WHERE_USE_LIMIT==SF_FixedLimit ); + /* Begin the database scan. */ SELECTTRACE(1,pParse,p,("WhereBegin\n")); @@ -5912,6 +5921,7 @@ int sqlite3Select( } assert( p->pEList==pEList ); +#ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ int addrGosub = sqlite3VdbeMakeLabel(v); int iCont = sqlite3VdbeMakeLabel(v); @@ -5927,7 +5937,9 @@ int sqlite3Select( sqlite3VdbeAddOp1(v, OP_Return, regGosub); sqlite3VdbeJumpHere(v, addr); - }else{ + }else +#endif /* SQLITE_OMIT_WINDOWFUNC */ + { /* Use the standard inner loop. */ selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest, sqlite3WhereContinueLabel(pWInfo), diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 294aaef41..9fab8f559 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2466,7 +2466,9 @@ struct Expr { AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ Table *pTab; /* Table for TK_COLUMN expressions. Can be NULL ** for a column of an index on an expression */ +#ifndef SQLITE_OMIT_WINDOWFUNC Window *pWin; /* Window definition for window functions */ +#endif }; /* @@ -2819,8 +2821,10 @@ struct Select { Select *pNext; /* Next select to the left in a compound */ Expr *pLimit; /* LIMIT expression. NULL means not used. */ With *pWith; /* WITH clause attached to this select. Or NULL. */ +#ifndef SQLITE_OMIT_WINDOWFUNC Window *pWin; /* List of window functions */ Window *pWinDefn; /* List of named window definitions */ +#endif }; /* @@ -3517,6 +3521,7 @@ struct Window { int iArgCol; /* Offset of first argument for this function */ }; +#ifndef SQLITE_OMIT_WINDOWFUNC void sqlite3WindowDelete(sqlite3*, Window*); void sqlite3WindowListDelete(sqlite3 *db, Window *p); Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*); @@ -3530,6 +3535,11 @@ void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*); Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p); Window *sqlite3WindowListDup(sqlite3 *db, Window *p); void sqlite3WindowFunctions(void); +#else +# define sqlite3WindowDelete(a,b) +# define sqlite3WindowFunctions() +# define sqlite3WindowAttach(a,b,c) +#endif /* ** Assuming zIn points to the first byte of a UTF-8 character, diff --git a/src/test_config.c b/src/test_config.c index aa0626ab2..d1837d485 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -762,6 +762,12 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY); #endif +#ifdef SQLITE_OMIT_WINDOWFUNC + Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "1", TCL_GLOBAL_ONLY); +#endif + #define LINKVAR(x) { \ static const int cv_ ## x = SQLITE_ ## x; \ Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ diff --git a/src/vdbe.c b/src/vdbe.c index 2c8920ff4..6eb5f9502 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -5118,7 +5118,9 @@ case OP_Rewind: { /* jump */ pCrsr = pC->uc.pCursor; assert( pCrsr ); rc = sqlite3BtreeFirst(pCrsr, &res); +#ifndef SQLITE_OMIT_WINDOWFUNC if( pOp->p5 ) sqlite3BtreeSkipNext(pCrsr); +#endif pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; } @@ -6369,8 +6371,13 @@ case OP_AggStep: { assert( pCtx->pOut->flags==MEM_Null ); assert( pCtx->isError==0 ); assert( pCtx->skipFlag==0 ); - (pOp->p1 ? (pCtx->pFunc->xInverse) : (pCtx->pFunc->xSFunc)) - (pCtx,pCtx->argc,pCtx->argv); /* IMP: R-24505-23230 */ +#ifndef SQLITE_OMIT_WINDOWFUNC + if( pOp->p1 ){ + (pCtx->pFunc->xInverse)(pCtx,pCtx->argc,pCtx->argv); + }else +#endif + (pCtx->pFunc->xSFunc)(pCtx,pCtx->argc,pCtx->argv); /* IMP: R-24505-23230 */ + if( pCtx->isError ){ if( pCtx->isError>0 ){ sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut)); @@ -6412,12 +6419,14 @@ case OP_AggFinal: { assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); pMem = &aMem[pOp->p1]; assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 ); +#ifndef SQLITE_OMIT_WINDOWFUNC if( pOp->p3 ){ rc = sqlite3VdbeMemAggValue(pMem, &aMem[pOp->p3], pOp->p4.pFunc); pMem = &aMem[pOp->p3]; - }else{ - rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc); - } + }else +#endif + rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc); + if( rc ){ sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem)); goto abort_due_to_error; diff --git a/src/vdbeInt.h b/src/vdbeInt.h index b0008c3d3..d6c566027 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -497,7 +497,9 @@ void sqlite3VdbeMemCast(Mem*,u8,u8); int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*); void sqlite3VdbeMemRelease(Mem *p); int sqlite3VdbeMemFinalize(Mem*, FuncDef*); +#ifndef SQLITE_OMIT_WINDOWFUNC int sqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*); +#endif const char *sqlite3OpcodeName(int); int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); int sqlite3VdbeMemClearAndResize(Mem *pMem, int n); diff --git a/src/vdbemem.c b/src/vdbemem.c index 6e0f8d6e0..dc0a3f970 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -423,6 +423,7 @@ int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ ** SQLITE_ERROR is returned if xValue() reports an error. SQLITE_OK ** otherwise. */ +#ifndef SQLITE_OMIT_WINDOWFUNC int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){ sqlite3_context ctx; Mem t; @@ -440,6 +441,7 @@ int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){ pFunc->xValue(&ctx); return ctx.isError; } +#endif /* SQLITE_OMIT_WINDOWFUNC */ /* ** If the memory cell contains a value that must be freed by diff --git a/src/window.c b/src/window.c index ff65d150e..5aa880011 100644 --- a/src/window.c +++ b/src/window.c @@ -12,6 +12,8 @@ */ #include "sqliteInt.h" +#ifndef SQLITE_OMIT_WINDOWFUNC + /* ** SELECT REWRITING ** @@ -2066,3 +2068,4 @@ void sqlite3WindowCodeStep( } } +#endif /* SQLITE_OMIT_WINDOWFUNC */ |