mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +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:
@@ -488,7 +488,8 @@ void sqlite3Insert(
|
||||
SrcList *pTabList, /* Name of table into which we are inserting */
|
||||
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 */
|
||||
int onError, /* How to handle constraint errors */
|
||||
ExprList *pUpsert /* Upsert values */
|
||||
){
|
||||
sqlite3 *db; /* The main database structure */
|
||||
Table *pTab; /* The table to insert into. aka TABLE */
|
||||
@@ -527,6 +528,11 @@ 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;
|
||||
@@ -1074,6 +1080,7 @@ insert_end:
|
||||
insert_cleanup:
|
||||
sqlite3SrcListDelete(db, pTabList);
|
||||
sqlite3ExprListDelete(db, pList);
|
||||
sqlite3ExprListDelete(db, pUpsert);
|
||||
sqlite3SelectDelete(db, pSelect);
|
||||
sqlite3IdListDelete(db, pColumn);
|
||||
sqlite3DbFree(db, aRegIdx);
|
||||
|
||||
Reference in New Issue
Block a user