1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Add infrastructure for doing an UPDATE as part of an UPSERT. Still no actual

UPDATE code, however.

FossilOrigin-Name: 6d3017f92bce3e50a91fab2f605e2af8b913b1b374adbfd977299eb042683de8
This commit is contained in:
drh
2018-04-13 18:59:17 +00:00
parent 12e40cebb7
commit 9eddacade9
5 changed files with 40 additions and 10 deletions

View File

@@ -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;