diff options
author | drh <drh@noemail.net> | 2019-10-21 01:04:11 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-10-21 01:04:11 +0000 |
commit | f5f1915d599b1a0aba8fab35178c90031fdb362d (patch) | |
tree | 769484211e7d36b9bdc428c0c942c1d05817aaf9 /src/expr.c | |
parent | dd6cc9b52abf6c4ae15a57a9f3d6e3c1e848f589 (diff) | |
download | sqlite-f5f1915d599b1a0aba8fab35178c90031fdb362d.tar.gz sqlite-f5f1915d599b1a0aba8fab35178c90031fdb362d.zip |
Changes to the INSERT logic to make it simpler and faster and so that
it works with generated columns and BEFORE triggers.
FossilOrigin-Name: bc368cb090376d33d3844e3689c4f6bd19eed758e39b878ee67fef93b1c839ea
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/src/expr.c b/src/expr.c index b868ed969..1c562fdf5 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4337,14 +4337,10 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ int inReg; assert( target>0 && target<=pParse->nMem ); - if( pExpr && pExpr->op==TK_REGISTER ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); - }else{ - inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); - assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); - if( inReg!=target && pParse->pVdbe ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); - } + inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); + assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); + if( inReg!=target && pParse->pVdbe ){ + sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); } } @@ -4375,30 +4371,6 @@ void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ } /* -** Generate code that evaluates the given expression and puts the result -** in register target. -** -** Also make a copy of the expression results into another "cache" register -** and modify the expression so that the next time it is evaluated, -** the result is a copy of the cache register. -** -** This routine is used for expressions that are used multiple -** times. They are evaluated once and the results of the expression -** are reused. -*/ -void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){ - Vdbe *v = pParse->pVdbe; - int iMem; - - assert( target>0 ); - assert( pExpr->op!=TK_REGISTER ); - sqlite3ExprCode(pParse, pExpr, target); - iMem = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Copy, target, iMem); - exprToRegister(pExpr, iMem); -} - -/* ** Generate code that pushes the value of every element of the given ** expression list into a sequence of registers beginning at target. ** |