Sqlite3 update line syntax

From the sqlite3 docs, it looks like I should use the following syntax to update a row in a database on my iPhone:


NSString *dbFile  = [[NSBundle mainBundle] pathForResource:@"database" ofType:@"db"];
sqlite3 *database  = NULL;

if (sqlite3_open([dbFile UTF8String], &database) == SQLITE_OK) {
 NSString *sql = [NSString stringWithFormat:@"update mytable set myfirstcolumn=%d, mysecondcolumn=%d where id=%d", int1, int2, int3];
 sqlite3_exec(database, [sql UTF8String], MyCallback, nil, nil);
}

sqlite3_close(database);

But it does not update the database or even call the callback method. This is just the wrong syntax, since sqlite3_exec () cannot update, for example?

In my example, all column names are correct, and the three int values ​​are registered as the correct values, so I'm partly from ideas ...

Thank.

+3
source share
2 answers

, , , . , . , .

, , Documents , , , ( ). , .

+2

sqlite3_exec (int), , . ?

sqlite3_exec(database, [sql UTF8String], MyCallback, nil, &errorMsg);
0

Source: https://habr.com/ru/post/1759292/


All Articles