1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Minor simplification to the upsert logic.

FossilOrigin-Name: e657c1d60f5fca9464e9bcab24bc328855bec9986e0a029877f639355da4b201
This commit is contained in:
drh
2018-04-19 21:29:52 +00:00
parent a67d02f509
commit 2633b28983
3 changed files with 12 additions and 10 deletions

View File

@@ -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"));
}