开发者

Any FREE SQLite Manager for MAC OS X?

开发者 https://www.devze.com 2023-02-16 18:34 出处:网络
I am learning Core Data for iPhone application. I defined .xcdatamodel. But I have the following questions:

I am learning Core Data for iPhone application. I defined .xcdatamodel. But I have the following questions:

  1. Is it possible to make .sqli开发者_运维技巧te file from the .xcdatamodel file ?
  2. If not, what is the correct procedure to prepare .sqlite ?
  3. If it is necessary to use external tool, is there any FREE tool to make .sqlite ?

Thanks.


Your questions 1 & 2 have already been answered but here's a comprehensive overview for Q3:

http://www.barefeetware.com/sqlite/compare/?ch

I personally use a (free) Firefox add-on called SQLite Manager - you can download it from here https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/


Is it possible to make .sqlite file from the .xcdatamodel file ?

Well, when you create a Core Data stack and set your store to an SQLite store, the persistent store coordinator will create a .sqlite file configured for the model attached to the store.

If not, what is the correct procedure to prepare .sqlite ?

Before iOS 3.0, you couldn't use Core Data so there were several libraries out there for using SQLite. However, I don't think any of them have been updated because there is not much point when using Core Data.

If it is necessary to use external tool, is there any FREE tool to make .sqlite ?

SQLite comes standard as part of MacOS X so you can use the command line or scripting languages like Ruby, Python, Perl (also standard) to create any SQLite database you want.

But honestly, I wouldn't bother. Unless your app's data is very simple and largely static, you will end up reinventing the wheel and effectively reproducing most of Core Data just to interface SQLite with the rest of the app.


Core Data's SQLite structure really isn't designed to be handled by anything other than Core Data. Even if you have your persistent store use the SQLite data format, if you open it in a generic SQLite tool you're going to get a cryptic mash of nothing-you-can-reliably-mess-with.

I'm guessing your goal is to have pre-populated data in your database? The right way to do that is to write some “importer” code that reads in whatever existing data you have and creates objects in the persistent store corresponding to those. Keep a copy of that persistent store—maybe in your app bundle, to be copied out to a temporary directory for writing—and you've got yourself a starting data set.

0

精彩评论

暂无评论...
验证码 换一张
取 消