Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which threading mode is Sqlite for iOS compiled in?

The page http://www.sqlite.org/threadsafe.html mentions:

  • Single-thread
  • Multi-thread
  • Serialized

Which mode is the sqlite that is integrated in iOS 5 compiled in?

like image 547
guruz Avatar asked Jan 15 '12 18:01

guruz


2 Answers

OK, so sqlite3_threadsafe() returns 2 so it is compiled with SQLITE_CONFIG_MULTITHREAD on iOS. That is unfortunate, I would have liked Serialized.

sqlite3_config(SQLITE_CONFIG_SERIALIZED) unfortunately gives me SQLITE_MISUSE

like image 121
guruz Avatar answered Nov 13 '22 20:11

guruz


As per this answer - https://stackoverflow.com/a/7799021/40444

It appears you can do the following:

sqlite3_shutdown();
if (sqlite3_config(SQLITE_CONFIG_SERIALIZED) == SQLITE_OK) {
    NSLog(@"sqlite configured to be threadsafe);
}
sqlite3_initialize();

However it's unclear if this officially works.

like image 43
Glen T Avatar answered Nov 13 '22 18:11

Glen T