Re: Accessing CoreData Sqlite db from outside Cocoa app
Re: Accessing CoreData Sqlite db from outside Cocoa app
- Subject: Re: Accessing CoreData Sqlite db from outside Cocoa app
- From: Greg Herlihy <email@hidden>
- Date: Fri, 03 Mar 2006 12:27:04 -0800
- Thread-topic: Accessing CoreData Sqlite db from outside Cocoa app
There's nothing mysterious about the structure of the sqlite3 databases that
Core Data creates. It uses a standard relational database structure with
entities as tables and columns to cross reference tables to establish
relationships.
But I don't see any advantage in reading directly from the sqlite3 database,
and personally I would advise against it. There is nothing in the database
that would not be much more easily accessible via Core Data's own classes.
Using Core Data classes to discover the structure, relationships and
constraints of the database has other advantages: most importantly,
accessing the database through Core Data will work with any kind of
underlying data storage: including XML, binary or a custom back end.
Furthermore, a program that uses the Core Data API is much less likely to
break with future versions than one that relies on undocumented sqlite3
database structures.
Greg
On 3/3/06 4:07 AM, "Ian" <email@hidden> wrote:
> Hi all,
>
> I've searched and searched for help on this and can't find anything
> of any real help so far:
> Has anyone any experience of accessing the contents of a CoreData
> sqlite db from outside a Cocoa app?
>
> Since it's a regular sqlite3 db it's easy to peek into it from the
> command line, or from PHP for example, but I'm not sure how to do
> very much with what I see there.
>
> For example, say I have a very simple app with a User entity, a
> Template entity and a relationship between the two entities that
> allows templates to 'belong' to users.
>
> Examining the db from outside CoreData I can see the Template enitity
> has become a ZTEMPLATE table, likewise User has become ZUSER.
>
> I can browse the tables (eg; select * from ZUSER) but don't see any
> way to browse relationships between the enitities.
>
> Furthermore, as I add users and templates to the db from within my
> app, CoreData adds all sorts of weird and wonderful tables presumably
> to manage the relationships but these tables just contain numbers.
>
> Anyone have a better clue than I do about any of this?
>
> Many TIA
> Ian
>
> PS - I don't plan on writing to the db from outside CoreData as I
> know this is dangerous, I just want to read from it.
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden