Skip navigation.
 
mlRe: core data and sqlite db store problem
FROM : Adam Swift
DATE : Wed Apr 02 02:07:07 2008

On Mar 31, 2008, at 10:23 AM, Scott Guyer wrote:

> Thanks Jeff,
>
>  That would explain it.  Crikey...whole lotta Zs in the CD created 
> SQLite schema.  :)
>
> In XCode, there is an Design -> Data Model -> Import... menu item. 
> It is looking to import an XML file of a particular format.  Any 
> pointers to this format?  Could this be a way for me to bootstrap 
> data into my CD created SQLite DB file?
>


The Design -> Data Model -> Import... menu item can be used to import 
a schema from a compiled datamodel file (eg. MyModel.mom) into a data 
model design document (MyModel.xcdatamodel).  There's no direct 
support for importing data from external data sources (raw sqlite 
files, etc).

> Thanks again.
>
>
> On Mar 31, 2008, at 12:51 PM, Jeff LaMarche wrote:
>

>> Core data stores metadata as well as data in the sqlite3 file and 
>> follows a very specific naming convention for the regular data 
>> tables and columns. You'd probably be better off writing a small 
>> migration utility to import the data you need than to try create a 
>> sqlite3 database in the right format. Also, if you use this 
>> mechanism, when you distribute your app, none of that data will go 
>> with it.
>>
>> Why don't you move out your sqlite3 file and let it create a new 
>> one, then go in and look at the tables and structure, and you'll 
>> get an idea of what I'm talking about.
>>
>> HTH
>> Jeff
>> On Mar 31, 2008, at 12:45 PM, Scott Guyer wrote:
>>

>>> Hi,
>>>
>>> I'm just learning core data and have already stumbled on 
>>> something.  I created a CD application using the XCode template. 
>>> I've created a sqlite3 .db file with data and a matching core data 
>>> model in xcode.  My code fails here...
>>>
>>>  url = [NSURL fileURLWithPath: [applicationSupportFolder 
>>> stringByAppendingPathComponent: @"my.db"]];
>>>  persistentStoreCoordinator = [[NSPersistentStoreCoordinator 
>>> alloc] initWithManagedObjectModel: [self managedObjectModel]];
>>>  if (![persistentStoreCoordinator 
>>> addPersistentStoreWithType:NSSQLiteStoreType configuration:nil 
>>> URL:url options:nil error:&error]){
>>>      [[NSApplication sharedApplication] presentError:error];
>>>  }
>>>
>>> with an error saying that the db file cannot be opened because it 
>>> is not in the right format.  "The file might be corrupted, 
>>> truncated, or in a different format than you expect."  That's 
>>> quite odd to me, since I can interact with that db file on the 
>>> command line using sqlite3 just fine.  Anyone have any ideas/
>>> suggestions?
>>>
>>> Much appreciated!
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (<email_removed>)
>>>
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>>
>>> This email sent to <email_removed>

>>

>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlcore data and sqlite db store problem Scott Guyer Mar 31, 18:45
mlRe: core data and sqlite db store problem Jeff LaMarche Mar 31, 18:51
mlRe: core data and sqlite db store problem Scott Guyer Mar 31, 19:23
mlRe: core data and sqlite db store problem Adam Swift Apr 2, 02:07