Ilya Suzdalnitski
Ilya Suzdalnitski

Reputation: 53560

How to commit changes in SQLite?

I've got a problem in my database - somehow changes sometimes are not being autocommitted so I need to COMMIT the manually.

How can I do this? What code do I have to write in objective-C in order to commit changes in SQLite?

I am developing an iPhone application.

Thanks.

Upvotes: 2

Views: 5695

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 882083

As I just happened to write to another question, the simplest way is:

char* errmsg;
int result = sqlite3_exec(database, "COMMIT", NULL, NULL, &errmsg);

with the usual result codes &c (you'll need to sqlite3_free(errmsg) after you've used the error message it points to, if any).

Upvotes: 4

Related Questions