• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing CoreData Sqlite db from outside Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing CoreData Sqlite db from outside Cocoa app


  • Subject: Re: Accessing CoreData Sqlite db from outside Cocoa app
  • From: Scott Thompson <email@hidden>
  • Date: Mon, 6 Mar 2006 12:50:05 -0600


On Mar 3, 2006, at 5:13 PM, Ian wrote:
Agreed, kind of ;)
There's nothing *too* mysterious, it's trivial to reverse engineer the database by examining it's contents.
For example, in my case with my Template and User entities and the relationship (many to many) between them I can see that User becomes ZUSER, Template becomes ZTEMPLATE.
I think what I should've made clear in my original question was can I always rely on 'Entity' becoming 'ZENTITY' so I can find it in the database for example?

I'd posit that that wold be a dangerous assumption. Core Data seems to depend rather heavily on the object model for the data set (usually stored in those data design documents, but you can build them on-the-fly). If you make assumptions as to how the relationships expressed in the model are represented in the data store, I can only think that you would be asking for trouble when Core Data is revised in the future.


Relationships are a little harder to predict I think because the only way I can see to do it is to reverse engineer the database, rather than conform to some 'proper' method or other.

Well, that, or you could find out how the model files work.

For example, the relationship between a User and a Template entity is recorded in a table called 'Z_6USERS' (where did that name come from?).
This table has two fields - 'Z_6TEMPLATES1' and 'Z_7USERS' - whose field entries are integer numbers that indicate the 'Z_PK' (primary key) field of the ZTEMPLATE and ZUSER records respectively.


This is not a problem to reverse engineer, but I was asking if there was some logic behind the naming convention of 'Z_6USERS' and 'Z_6TEMPLATES1' and 'Z_7USERS'.

Probably so, however, I be very wary of depending on the idea that the logic would stay the same in future versions of Core Data. If you want to pair your application code with external applications, it is my opinion (and worth just that :-) that you should probably develop your own Database Schema and use the primitive sqlite functions from your application.


Scott



_______________________________________________
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


References: 
 >Re: Accessing CoreData Sqlite db from outside Cocoa app (From: Greg Herlihy <email@hidden>)
 >Re: Accessing CoreData Sqlite db from outside Cocoa app (From: Ian <email@hidden>)

  • Prev by Date: Re: Core Data fetch returns wrong entities.
  • Next by Date: Re: Text Layout problems
  • Previous by thread: Re: Accessing CoreData Sqlite db from outside Cocoa app
  • Next by thread: [ANN] DMG Packager 1.0
  • Index(es):
    • Date
    • Thread