1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

More complete parsing of UPSERT, including UPSERT within a trigger.

The sqlite3Insert() logic to actually perform the UPSERT is not yet
implemented, however.

FossilOrigin-Name: 5cc2a5a315a2f26b392811de45b3dc352873a173c2c6c65f37ce2e5f88a71cd2
This commit is contained in:
drh
2018-04-07 15:04:05 +00:00
parent 26cf56f80b
commit 2c2e844a36
7 changed files with 86 additions and 28 deletions

View File

@@ -416,6 +416,7 @@ TriggerStep *sqlite3TriggerInsertStep(
IdList *pColumn, /* List of columns in pTableName to insert into */
Select *pSelect, /* A SELECT statement that supplies values */
u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
ExprList *pUpsert, /* Upsert values */
const char *zStart, /* Start of SQL text */
const char *zEnd /* End of SQL text */
){
@@ -430,6 +431,7 @@ TriggerStep *sqlite3TriggerInsertStep(
pTriggerStep->orconf = orconf;
}else{
sqlite3IdListDelete(db, pColumn);
sqlite3ExprListDelete(db, pUpsert);
}
sqlite3SelectDelete(db, pSelect);
@@ -755,7 +757,8 @@ static int codeTriggerProgram(
targetSrcList(pParse, pStep),
sqlite3SelectDup(db, pStep->pSelect, 0),
sqlite3IdListDup(db, pStep->pIdList),
pParse->eOrconf
pStep->pExprList ? OE_Update : pParse->eOrconf,
sqlite3ExprListDup(db, pStep->pExprList, 0)
);
break;
}