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

Add the Upsert object for holding upsert clause information.

FossilOrigin-Name: d83eaed539b274c2abd650d07522f491865d4917acbb64d05d01b3ba5c3cd446
This commit is contained in:
drh
2018-04-12 13:15:43 +00:00
parent 35e86bf15d
commit 46d2e5c35a
7 changed files with 81 additions and 76 deletions

View File

@@ -489,7 +489,7 @@ void sqlite3Insert(
Select *pSelect, /* A SELECT statement to use as the data source */
IdList *pColumn, /* Column names corresponding to IDLIST. */
int onError, /* How to handle constraint errors */
ExprList *pUpsert /* Upsert values */
Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */
){
sqlite3 *db; /* The main database structure */
Table *pTab; /* The table to insert into. aka TABLE */
@@ -528,11 +528,6 @@ void sqlite3Insert(
int tmask; /* Mask of trigger times */
#endif
/* The conflict resolution type is always OE_Update or OE_Replace when
** there is an upsert clause */
assert( onError==OE_Update || pUpsert==0 );
assert( OE_Update==OE_Replace );
db = pParse->db;
if( pParse->nErr || db->mallocFailed ){
goto insert_cleanup;
@@ -1080,7 +1075,7 @@ insert_end:
insert_cleanup:
sqlite3SrcListDelete(db, pTabList);
sqlite3ExprListDelete(db, pList);
sqlite3ExprListDelete(db, pUpsert);
sqlite3UpsertDelete(db, pUpsert);
sqlite3SelectDelete(db, pSelect);
sqlite3IdListDelete(db, pColumn);
sqlite3DbFree(db, aRegIdx);