Hi.
I caught the issue on Mac that a database sometimes becomes malformed. After spending hours of debugging to understand the problem I noticed that key is set after the transaction is initiated to perform table updates. After moving sqlite3_key
after begin exclusive transaction
the issue is gone.
Could this really be the reason?
Objective-C FMDB wrapper around SQLite is used.
Works fine.
[dbQueue inDatabase:^(FMDatabase *db) {
[db setKeySafe:[DBManager getPragmaKey]];
[db beginTransaction];
...
];
The reason is that a database becomes malformed.
[dbQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
[db setKeySafe:[DBManager getPragmaKey]];
...
];