[baseten-users] CopyWithZone

Tuukka Norri tuukka.norri at karppinen.fi
Thu Dec 3 01:27:08 EET 2009


Hi!

Michael Ruepp kirjoitti 2.12.2009 kello 23.52:
> how would I then copy an object and its related objects on a best way?
This is a bit difficult to say without knowing the exact situation. If you just need the column values, you could call -primitiveValueForKey: for each value and copy those.

> And, how can I work with XML Data types? - I would have returned XML Data as NSXMLDocument instead of NSData. And how can I insert XML? There is no XML Data Type in the Cora Data xcdatamodel.
To have a column the contents of which are automatically returned as an NSXMLDocument you would have to write some SQL to create or change the relevant table and add a constraint like CHECK (column IS DOCUMENT). (See the manual's section 2.6.3.) If you don't care about the column type you could subclass BXDatabaseObject and write custom accessors that create the NSXMLDocument from a text or binary column's contents and convert that to text or data on input.
-- 
Best regards,
Tuukka Norri
MK&C





More information about the baseten-users mailing list