aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-04-13 18:59:17 +0000
committerdrh <drh@noemail.net>2018-04-13 18:59:17 +0000
commit9eddacade98fe544702c34b1eeb3e7d035b241c2 (patch)
tree7fe040dc8c650aab5d69c4f5d7543921f515e7de /src/insert.c
parent12e40cebb70297099806a50de652c71d3182a801 (diff)
downloadsqlite-9eddacade98fe544702c34b1eeb3e7d035b241c2.tar.gz
sqlite-9eddacade98fe544702c34b1eeb3e7d035b241c2.zip
Add infrastructure for doing an UPDATE as part of an UPSERT. Still no actual
UPDATE code, however. FossilOrigin-Name: 6d3017f92bce3e50a91fab2f605e2af8b913b1b374adbfd977299eb042683de8
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/insert.c b/src/insert.c
index fb4f442e9..c794b1ad7 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1484,6 +1484,12 @@ void sqlite3GenerateConstraintChecks(
seenReplace = 1;
break;
}
+#ifndef SQLITE_OMIT_UPSERT
+ case OE_Update: {
+ sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur, 0);
+ /* Fall through */
+ }
+#endif
case OE_Ignore: {
sqlite3VdbeGoto(v, ignoreDest);
break;
@@ -1666,7 +1672,7 @@ void sqlite3GenerateConstraintChecks(
/* Generate code that executes if the new index entry is not unique */
assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
- || onError==OE_Ignore || onError==OE_Replace );
+ || onError==OE_Ignore || onError==OE_Replace || onError==OE_Update );
switch( onError ){
case OE_Rollback:
case OE_Abort:
@@ -1674,6 +1680,12 @@ void sqlite3GenerateConstraintChecks(
sqlite3UniqueConstraint(pParse, onError, pIdx);
break;
}
+#ifndef SQLITE_OMIT_UPSERT
+ case OE_Update: {
+ sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iDataCur, iIdxCur);
+ /* Fall through */
+ }
+#endif
case OE_Ignore: {
sqlite3VdbeGoto(v, ignoreDest);
break;