Sqlite master data corruption after power failure

I am writing a simple Cocoa application in 10.6. I had a power failure while the program was running (the program is periodically stored in the data store), and the sqlite file that my program uses is somehow damaged.

I create the managed object context in the standard way:

managedObjectContext = [[NSManagedObjectContext alloc] init];
[managedObjectContext setPersistentStoreCoordinator: coordinator];

and usually everything is fine, but this time when reading the object:

NSLog(@"%@",dir.files);

I get:

2011-06-03 11:33:38.079 Backup Check[1927:3c03] Relationship fault for 
(<NSRelationshipDescription: 0x100562230>), name files, isOptional 1, 
isTransient 0, entity Directory, renamingIdentifier files, validation 
predicates ( 
), warnings (
), versionHashModifier (null), destination entity File, inverseRelationship
directory, minCount 0, maxCount 0 on 0x10058bbc0

I tried the sqlite3 tool on the command line, and many things can be read correctly, but for some tables I get a bunch of records in the table, and then:

SQL error: database disk image is malformed

, . : 1) / ? , . , , subtables, . null, - NSSet. - . 2) ? , , ? , .

+3
1

API SQL. , . SQL Server 5 .

, NSLog, . "" , , . - "" , . , . Fetches , .

SQL , db . . , SQL db . , . (-, Apple.)

, - . , . ( - .) , , - , , . , . , .

, . , , , , , .

+3

All Articles