diff options
author | drh <drh@noemail.net> | 2018-04-19 21:29:52 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-19 21:29:52 +0000 |
commit | 2633b289832043967d56fbfd46b7b0bd201e9a08 (patch) | |
tree | 7065e17ffe352fd4010a38517a93b679c0d1a115 /src | |
parent | a67d02f509b807d39024731a9f6ec594218b0964 (diff) | |
download | sqlite-2633b289832043967d56fbfd46b7b0bd201e9a08.tar.gz sqlite-2633b289832043967d56fbfd46b7b0bd201e9a08.zip |
Minor simplification to the upsert logic.
FossilOrigin-Name: e657c1d60f5fca9464e9bcab24bc328855bec9986e0a029877f639355da4b201
Diffstat (limited to 'src')
-rw-r--r-- | src/upsert.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/upsert.c b/src/upsert.c index 866f9b953..9e23c86bf 100644 --- a/src/upsert.c +++ b/src/upsert.c @@ -258,10 +258,12 @@ void sqlite3UpsertDoUpdate( pWhere = sqlite3ExprAnd(db,pWhere,sqlite3PExpr(pParse, TK_EQ, pE1, pE2)); } } + /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So + ** we have to make a copy before passing it down into sqlite3Update() */ pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0); - sqlite3Update(pParse, pSrc, - sqlite3ExprListDup(db, pUpsert->pUpsertSet, 0), + sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet, pWhere, OE_Abort, 0, 0, pUpsert); + pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */ VdbeNoopComment((v, "End DO UPDATE of UPSERT")); } |