Reputation: 187
Or could it be that Core Data splits the save operation into several sequential atomic steps? For my work, I have to be sure that when re-accessing the database after a crash, either everything was saved, or I'm rolled back to the state before the save operation. I must not have the case where some modified NSObject's were saved but some not.
NB: I'm using the following SQLite pragma options (do I need any others to ensure atomicity?):
[pragmaOptions setObject:@"FULL" forKey:@"synchronous"];
[pragmaOptions setObject:@"1" forKey:@"fullfsync"];
[pragmaOptions setObject:@"WAL" forKey:@"journal_mode"];
Upvotes: 4
Views: 628
Reputation: 6715
Yes, Core Data’s -save
is transactional. Either everything gets saved or nothing. That's true regardless of which store you use.
Upvotes: 4