iphonesqlitecore-datasqlitemanager

Core data prefilling sqlite db. What is Z_MAX?


I am using the SQLite Manager extension to Firefox to prefill my core data sqlite database.

But when i try adding more to the prefilled database my app crashes. I suspect it has something to do with Z_MAX for my entity in the table Z_PRIMARYKEY.

What should i set Z_MAX to? Is it supposed to be the number of items in my entity?

So if i add 1000 entries in the table Z_MYENTITY then i have to set Z_MAX to the correspoding entity in Z_PRIMARYKEY to 1000?


Solution

  • I highly recommend not trying to replicate the internal structure of a Core Data database. It is undocumented and not guaranteed by Apple to remain the same over time (even though it has been relatively stable).

    Instead, I suggest creating a simple Mac client to prepopulate your database. This is a very easy thing to do, as I described in this answer. I also show how to do this in the video for the Core Data session of my iPhone class on iTunes U.