11/******************************************************************************
22** This file is an amalgamation of many separate C source files from SQLite
3- ** version 3.35.3 . By combining all the individual C code files into this
3+ ** version 3.35.4 . By combining all the individual C code files into this
44** single large file, the entire code can be compiled as a single translation
55** unit. This allows many compilers to do optimizations that would not be
66** possible if the files were compiled separately. Performance improvements
@@ -1186,9 +1186,9 @@ extern "C" {
11861186** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11871187** [sqlite_version()] and [sqlite_source_id()].
11881188*/
1189- #define SQLITE_VERSION "3.35.3 "
1190- #define SQLITE_VERSION_NUMBER 3035003
1191- #define SQLITE_SOURCE_ID "2021-03-26 12:12:52 4c5e6c200adc8afe0814936c67a971efc516d1bd739cb620235592f18f40be2a "
1189+ #define SQLITE_VERSION "3.35.4 "
1190+ #define SQLITE_VERSION_NUMBER 3035004
1191+ #define SQLITE_SOURCE_ID "2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212df45e "
11921192
11931193/*
11941194** CAPI3REF: Run-Time Library Version Numbers
@@ -19764,6 +19764,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
1976419764SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*);
1976519765SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
1976619766SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
19767+ SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*);
1976719768SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
1976819769SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
1976919770SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
@@ -99002,15 +99003,19 @@ static int lookupName(
9900299003 if( pParse->pTriggerTab!=0 ){
9900399004 int op = pParse->eTriggerOp;
9900499005 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
99005- if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
99006+ if( pParse->bReturning ){
99007+ if( (pNC->ncFlags & NC_UBaseReg)!=0
99008+ && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
99009+ ){
99010+ pExpr->iTable = op!=TK_DELETE;
99011+ pTab = pParse->pTriggerTab;
99012+ }
99013+ }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
9900699014 pExpr->iTable = 1;
9900799015 pTab = pParse->pTriggerTab;
9900899016 }else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
9900999017 pExpr->iTable = 0;
9901099018 pTab = pParse->pTriggerTab;
99011- }else if( pParse->bReturning && (pNC->ncFlags & NC_UBaseReg)!=0 ){
99012- pExpr->iTable = op!=TK_DELETE;
99013- pTab = pParse->pTriggerTab;
9901499019 }
9901599020 }
9901699021#endif /* SQLITE_OMIT_TRIGGER */
@@ -101605,8 +101610,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
101605101610 }else if( (ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight))
101606101611 && !IN_RENAME_OBJECT
101607101612 ){
101608- sqlite3ExprDelete(db , pLeft);
101609- sqlite3ExprDelete(db , pRight);
101613+ sqlite3ExprDeferredDelete(pParse , pLeft);
101614+ sqlite3ExprDeferredDelete(pParse , pRight);
101610101615 return sqlite3Expr(db, TK_INTEGER, "0");
101611101616 }else{
101612101617 return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
@@ -101803,6 +101808,22 @@ SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
101803101808 if( p ) sqlite3ExprDeleteNN(db, p);
101804101809}
101805101810
101811+
101812+ /*
101813+ ** Arrange to cause pExpr to be deleted when the pParse is deleted.
101814+ ** This is similar to sqlite3ExprDelete() except that the delete is
101815+ ** deferred untilthe pParse is deleted.
101816+ **
101817+ ** The pExpr might be deleted immediately on an OOM error.
101818+ **
101819+ ** The deferred delete is (currently) implemented by adding the
101820+ ** pExpr to the pParse->pConstExpr list with a register number of 0.
101821+ */
101822+ SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){
101823+ pParse->pConstExpr =
101824+ sqlite3ExprListAppend(pParse, pParse->pConstExpr, pExpr);
101825+ }
101826+
101806101827/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
101807101828** expression.
101808101829*/
@@ -106428,8 +106449,7 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
106428106449 pExpr = sqlite3ExprDup(db, pExpr, 0);
106429106450 if( pExpr ){
106430106451 pAggInfo->aCol[iAgg].pCExpr = pExpr;
106431- pParse->pConstExpr =
106432- sqlite3ExprListAppend(pParse, pParse->pConstExpr, pExpr);
106452+ sqlite3ExprDeferredDelete(pParse, pExpr);
106433106453 }
106434106454 }
106435106455 }else{
@@ -106438,8 +106458,7 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
106438106458 pExpr = sqlite3ExprDup(db, pExpr, 0);
106439106459 if( pExpr ){
106440106460 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
106441- pParse->pConstExpr =
106442- sqlite3ExprListAppend(pParse, pParse->pConstExpr, pExpr);
106461+ sqlite3ExprDeferredDelete(pParse, pExpr);
106443106462 }
106444106463 }
106445106464 }
@@ -139315,6 +139334,25 @@ SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(
139315139334 return pSrc;
139316139335}
139317139336
139337+ /*
139338+ ** Return true if the pExpr term from the RETURNING clause argument
139339+ ** list is of the form "*". Raise an error if the terms if of the
139340+ ** form "table.*".
139341+ */
139342+ static int isAsteriskTerm(
139343+ Parse *pParse, /* Parsing context */
139344+ Expr *pTerm /* A term in the RETURNING clause */
139345+ ){
139346+ assert( pTerm!=0 );
139347+ if( pTerm->op==TK_ASTERISK ) return 1;
139348+ if( pTerm->op!=TK_DOT ) return 0;
139349+ assert( pTerm->pRight!=0 );
139350+ assert( pTerm->pLeft!=0 );
139351+ if( pTerm->pRight->op!=TK_ASTERISK ) return 0;
139352+ sqlite3ErrorMsg(pParse, "RETURNING may not use \"TABLE.*\" wildcards");
139353+ return 1;
139354+ }
139355+
139318139356/* The input list pList is the list of result set terms from a RETURNING
139319139357** clause. The table that we are returning from is pTab.
139320139358**
@@ -139332,7 +139370,8 @@ static ExprList *sqlite3ExpandReturning(
139332139370
139333139371 for(i=0; i<pList->nExpr; i++){
139334139372 Expr *pOldExpr = pList->a[i].pExpr;
139335- if( ALWAYS(pOldExpr!=0) && pOldExpr->op==TK_ASTERISK ){
139373+ if( NEVER(pOldExpr==0) ) continue;
139374+ if( isAsteriskTerm(pParse, pOldExpr) ){
139336139375 int jj;
139337139376 for(jj=0; jj<pTab->nCol; jj++){
139338139377 Expr *pNewExpr;
@@ -147570,6 +147609,7 @@ static void exprAnalyzeExists(
147570147609#endif
147571147610 if( pSel->pPrior ) return;
147572147611 if( pSel->pWhere==0 ) return;
147612+ if( pSel->pLimit ) return;
147573147613 if( 0==exprAnalyzeExistsFindEq(pSel, 0, 0) ) return;
147574147614
147575147615 pDup = sqlite3ExprDup(db, pExpr, 0);
@@ -155354,6 +155394,7 @@ static void windowCheckValue(Parse *pParse, int reg, int eCond){
155354155394 VdbeCoverageIf(v, eCond==2);
155355155395 }
155356155396 sqlite3VdbeAddOp3(v, aOp[eCond], regZero, sqlite3VdbeCurrentAddr(v)+2, reg);
155397+ sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC);
155357155398 VdbeCoverageNeverNullIf(v, eCond==0); /* NULL case captured by */
155358155399 VdbeCoverageNeverNullIf(v, eCond==1); /* the OP_MustBeInt */
155359155400 VdbeCoverageNeverNullIf(v, eCond==2);
@@ -229253,7 +229294,7 @@ static void fts5SourceIdFunc(
229253229294){
229254229295 assert( nArg==0 );
229255229296 UNUSED_PARAM2(nArg, apUnused);
229256- sqlite3_result_text(pCtx, "fts5: 2021-03-26 12:12:52 4c5e6c200adc8afe0814936c67a971efc516d1bd739cb620235592f18f40be2a ", -1, SQLITE_TRANSIENT);
229297+ sqlite3_result_text(pCtx, "fts5: 2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212df45e ", -1, SQLITE_TRANSIENT);
229257229298}
229258229299
229259229300/*
@@ -234179,9 +234220,9 @@ SQLITE_API int sqlite3_stmt_init(
234179234220#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
234180234221
234181234222/************** End of stmt.c ************************************************/
234182- #if __LINE__!=234182
234223+ #if __LINE__!=234223
234183234224#undef SQLITE_SOURCE_ID
234184- #define SQLITE_SOURCE_ID "2021-03-26 12:12:52 4c5e6c200adc8afe0814936c67a971efc516d1bd739cb620235592f18f40alt2 "
234225+ #define SQLITE_SOURCE_ID "2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212dalt2 "
234185234226#endif
234186234227/* Return the source-id for this library */
234187234228SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
0 commit comments