aboutsummaryrefslogtreecommitdiff
path: root/src/build.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/build.c b/src/build.c
index c286b4bbe..e947f2c84 100644
--- a/src/build.c
+++ b/src/build.c
@@ -4473,3 +4473,34 @@ void sqlite3WithDelete(sqlite3 *db, With *pWith){
}
}
#endif /* !defined(SQLITE_OMIT_CTE) */
+
+#ifndef SQLITE_OMIT_UPSERT
+/*
+** Free a list of Upsert objects
+*/
+void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
+ while( p ){
+ Upsert *pNext = p->pUpsertNext;
+ sqlite3ExprListDelete(db, p->pUpsertTarget);
+ sqlite3ExprListDelete(db, p->pUpsertSet);
+ sqlite3DbFree(db, p);
+ p = pNext;
+ }
+}
+#endif /* SQLITE_OMIT_UPSERT */
+
+#ifndef SQLITE_OMIT_UPSERT
+/*
+** Duplicate an Upsert object
+*/
+Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
+ Upsert *pNew;
+ if( p==0 ) return 0;
+ pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
+ if( pNew==0 ) return 0;
+ pNew->pUpsertTarget = sqlite3ExprListDup(db, p->pUpsertTarget, 0);
+ pNew->pUpsertSet = sqlite3ExprListDup(db, p->pUpsertSet, 0);
+ pNew->pUpsertNext = sqlite3UpsertDup(db, p->pUpsertNext);
+ return pNew;
+}
+#endif /* SQLITE_OMIT_UPSERT */