Re: Save As core data question
Re: Save As core data question
- Subject: Re: Save As core data question
- From: Gideon King <email@hidden>
- Date: Mon, 22 Mar 2010 11:33:00 +1000
Thanks Paul - good to know what the error message means. The only file in that folder is the saved as, saved as file.
When you do a save as, it appears that the steps core data follows are different than when it does the first save as. I have a simple project where I am trying to trace through all the stuff that goes on behind the scenes in core data during save and save as, to try to find ways of debugging my program. It has just a single managed object to make life simple.
So it appears that the first save does:
a. Initialize a new atomic store
b. Load a new blank document (but don't call awakeFromFetch)
c. Create new cache node (which causes the data to be read from the managed object)
d. Save the file
And then Save As:
a. Initializes a new atomic store
b. Reads from an empty file at the new save location within its temporary folder,
c. Create a new managed object as a clone of my original one, and call awakeFromFetch on it.
d. Create new cache node (which causes the data to be read from the new managed object)
e. Save the file
f. Delete the temporary managed object
g. Initialize another atomic store at the new save location in the temporary folder, but this time there is actually a file there from the previous steps
h. Read from the file which has just been created above
i. Save the file again, without going via the Managed Object layer, except to update the document id.
And the second Save As:
a. Initializes a new atomic store
b. Reads from an empty file at the new save location within its temporary folder,
c. Saves to the same location (which is strange, because it does not create any cache nodes, and nor does it update from any managed objects along the way, so I am assuming that the data from the previous cached nodes is reused somehow)
d. Initializes another new atomic store
e. Loads from the store it has just saved
f. Saves the file again
Now it also appears that the back end also clones my managed object, but I am not sure exactly at what point this happens. I think it's in the second load operation this time, and not in the first as per the first save as, but this time, awakeFromFetch is not called, and I only see that it existed when it is turned into a fault before the second save.
I have no idea how the data gets into the file in the second Save As, seeing as no cache nodes are created and updateCacheNode:fromManagedObject: is not called. And from a conceptual level, I don't understand why the second Save As should be different than the first.
Anyway, I will keep digging (wish this stuff was documented)...
Gideon
On 22/03/2010, at 3:55 AM, Paul Sanders wrote:
> From errno.h:
>
> #define ENOTEMPTY 66 /* Directory not empty */
> If that helps at all...
>
> Paul Sanders.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden