CODE A

FMDBDatabase *db = xxxxx
[db beginTransaction];
[db executeUpdate:xxxx];
xxxxxxx

CODE B

FMDBDatabaseQueue *queue = xxxxx
[queue inTransaction:^{xxxxxx}]

What is the difference between database.beginTransaction and databaseQueue.inTransaction? As I see inTransaction just do putting the sql actions in a queue, but beginTransaction seems to do something in sqlite level. Which one is a better choice for thread-safe and what's the difference between them?

Related posts

Recent Viewed