diff options
author | drh <> | 2022-04-07 01:11:13 +0000 |
---|---|---|
committer | drh <> | 2022-04-07 01:11:13 +0000 |
commit | d44f8b2385eeb97d799fe5172c7514972c6f3359 (patch) | |
tree | 0350d9b592093c18ddbd7eb5c8363e2dae5ba206 /src/expr.c | |
parent | 200adc9e75fdc08beaf70536d3983b3434e45ded (diff) | |
download | sqlite-d44f8b2385eeb97d799fe5172c7514972c6f3359.tar.gz sqlite-d44f8b2385eeb97d799fe5172c7514972c6f3359.zip |
Improved technique for parsing the ON and USING clauses of a join is faster
and uses less memory.
FossilOrigin-Name: 158156a3e3d50042cafc75dea3aaaa68b1f2efb9c3d178518ea6e68e32e0d21c
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 79889bdd7..2c00bb498 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1249,6 +1249,18 @@ void sqlite3ExprDelete(sqlite3 *db, Expr *p){ if( p ) sqlite3ExprDeleteNN(db, p); } +/* +** Clear both elements of an OnOrUsing object +*/ +void sqlite3ClearOnOrUsing(sqlite3 *db, OnOrUsing *p){ + if( p==0 ){ + /* Nothing to clear */ + }else if( p->pOn ){ + sqlite3ExprDeleteNN(db, p->pOn); + }else if( p->pUsing ){ + sqlite3IdListDelete(db, p->pUsing); + } +} /* ** Arrange to cause pExpr to be deleted when the pParse is deleted. @@ -1671,8 +1683,12 @@ SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int flags){ pTab->nTabRef++; } pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags); - pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags); - pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing); + if( pOldItem->fg.isUsing ){ + assert( pNewItem->fg.isUsing ); + pNewItem->u3.pUsing = sqlite3IdListDup(db, pOldItem->u3.pUsing); + }else{ + pNewItem->u3.pOn = sqlite3ExprDup(db, pOldItem->u3.pOn, flags); + } pNewItem->colUsed = pOldItem->colUsed; } return pNew; |