diff options
author | drh <drh@noemail.net> | 2020-07-10 21:43:53 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-07-10 21:43:53 +0000 |
commit | 6af305de1eeff5d94cacafd555f3fa6b8015b5eb (patch) | |
tree | ff24c9b4d9d040c7b82253543780b3f6d9d3bdef /src | |
parent | b16425d05a29faeec7dd77d71c0f466f8eb2340d (diff) | |
download | sqlite-6af305de1eeff5d94cacafd555f3fa6b8015b5eb.tar.gz sqlite-6af305de1eeff5d94cacafd555f3fa6b8015b5eb.zip |
Remove unnecessary code from the window functions implementation.
FossilOrigin-Name: 1e87da9c93309d1d69b1e0ab65c615b9ff9c1c6813ad0c7b90d2495be4ba0adc
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 10 | ||||
-rw-r--r-- | src/select.c | 15 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 | ||||
-rw-r--r-- | src/window.c | 1 |
4 files changed, 4 insertions, 23 deletions
diff --git a/src/expr.c b/src/expr.c index 9b63a569b..d56963736 100644 --- a/src/expr.c +++ b/src/expr.c @@ -52,12 +52,10 @@ char sqlite3ExprAffinity(const Expr *pExpr){ op = pExpr->op; if( op==TK_SELECT ){ assert( pExpr->flags&EP_xIsSelect ); - if( ALWAYS(pExpr->x.pSelect) - && pExpr->x.pSelect->pEList - && ALWAYS(pExpr->x.pSelect->pEList->a[0].pExpr) - ){ - return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); - } + assert( pExpr->x.pSelect!=0 ); + assert( pExpr->x.pSelect->pEList!=0 ); + assert( pExpr->x.pSelect->pEList->a[0].pExpr!=0 ); + return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); } if( op==TK_REGISTER ) op = pExpr->op2; #ifndef SQLITE_OMIT_CAST diff --git a/src/select.c b/src/select.c index 2df58fccd..b22c167a5 100644 --- a/src/select.c +++ b/src/select.c @@ -176,21 +176,6 @@ void sqlite3SelectDelete(sqlite3 *db, Select *p){ } /* -** Delete all the substructure for p, but keep p allocated. Redefine -** p to be a single SELECT where every column of the result set has a -** value of NULL. -*/ -void sqlite3SelectReset(Parse *pParse, Select *p){ - if( ALWAYS(p) ){ - clearSelect(pParse->db, p, 0); - memset(&p->iLimit, 0, sizeof(Select) - offsetof(Select,iLimit)); - p->pEList = sqlite3ExprListAppend(pParse, 0, - sqlite3ExprAlloc(pParse->db,TK_NULL,0,0)); - p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(SrcList)); - } -} - -/* ** Return a pointer to the right-most SELECT statement in a compound. */ static Select *findRightmost(Select *p){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a862f4a6c..f64ef5d23 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4248,7 +4248,6 @@ int sqlite3Select(Parse*, Select*, SelectDest*); Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, Expr*,ExprList*,u32,Expr*); void sqlite3SelectDelete(sqlite3*, Select*); -void sqlite3SelectReset(Parse*, Select*); Table *sqlite3SrcListLookup(Parse*, SrcList*); int sqlite3IsReadOnly(Parse*, Table*, int); void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); diff --git a/src/window.c b/src/window.c index 8656f51b0..ab8b5ce13 100644 --- a/src/window.c +++ b/src/window.c @@ -1082,7 +1082,6 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){ assert( pParse->db->mallocFailed ); sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM); } - sqlite3SelectReset(pParse, p); } return rc; } |