Is sqlite INSERT..ON CONFLICT..DO UPDATE supported in Swift 4.1?

337 Views Asked by At

I've been unsuccessfully trying to implement the following:

var queryResult: OpaquePointer? 
var query = "INSERT INTO myTable (id, remarks, status) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET remarks=?, status=?"            

if sqlite3_prepare_v2(dbase, query, -1, &queryResult, nil) == SQLITE_OK {
    sqlite3_bind_int(queryResult, 1, 7)                      // insert id
    sqlite3_bind_text(queryResult, 2, "my remarks, -1, nil)  // insert remarks      
    sqlite3_bind_int(queryResult, 3, 1)                      // insert status 
    sqlite3_bind_text(queryResult, 4, "my remarks, -1, nil)  // update remarks      
    sqlite3_bind_int(queryResult, 5, 1)                      // update status 
}

But I keep getting this error on sqlite3_prepare_v2:

sqlite3 error (near "ON": syntax error)

Is there some issue with my execution or does Swift 4.1 sqlite3 simply not support ON CONFLICT?

TIA

0

There are 0 best solutions below