ios - SQLite "database disk image is malformed" -


i having trouble app sqlite database getting corrupted. there odd case of previously, seems have become lot more common after release of ios 7.1.

i'm using sqlite wrapper matteo bertozzi can find here: https://github.com/connord/simple-sqlite

the database gets corrupted , spits out error database disk image malformed, queries can run existing data gets messed up.

i have searched high , low , can't find solution, i'm hoping here has ideas since becoming more common issue after ios update.

i've tried these repair commands:

[sqlite executenonquery:@"pragma integrity_check"]; [sqlite executenonquery:@"reindex nodes"]; [sqlite executenonquery:@"reindex pristine"]; 

and output was:

sqlite step failed: database disk image malformed sqlite prepare failed: unable identify object reindexed  - query: reindex nodes sqlite prepare failed: unable identify object reindexed  - query: reindex pristine` 

with further digging found problem: core data , ios 7: different behavior of persistent store mentions issues sqlite after ios7.

though have no idea how use nspersistentstore, tried running [sqlite executenonquery:@"pragma journal_mode = delete"]; , said sqlite step failed: unknown error.

is else experiencing this, or point me in right direction?

in meantime feel nspersistentstore potentially should doing.. have that.

edit:

from i've found use nspersistentstore when database isn't going updated, mine regularly.

here how open database:

sqlite = [[sqlite alloc] init];  nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *writabledbpath = [documentsdirectory stringbyappendingpathcomponent:@"homeopendatabase8.sql"];  if (![sqlite open:writabledbpath]) {     nslog(@"db not writable");     return; } else {     nslog(@"all good"); } 

so assume need find way set pragma journal_mode = delete way..?

edit 2:

i'm not convinced it's journal_mode i'm not using core data - drawing board.

the biggest flag me error popping after ios 7.1 released, surely can't coincidence.. i'll continue trying replicate issue on device.

i had problem on ios 7.0.6 using fmdb. repaired copying mac , using these commands:

http://www.dosomethinghere.com/2013/02/20/fixing-the-sqlite-error-the-database-disk-image-is-malformed/

my database dump rather large @ 200mb used hexfiend cut transaction , rollback commands.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -