有适用于 MAC OS X 的免费 SQLite 管理器吗?
我正在学习 iPhone 应用程序的 Core Data。我定义了.xcdatamodel。但我有以下问题:
- Is it possible to make .sqlite file 来自 .xcdatamodel 文件?
- 如果不是,正确的是什么 准备 .sqlite 的过程?
- 如果需要使用外部 工具,有没有免费的工具可以制作 .sqlite ?
谢谢。
I am learning Core Data for iPhone application. I defined .xcdatamodel. But I have the following questions:
- Is it possible to make .sqlite file
from the .xcdatamodel file ? - If not, what is the correct
procedure to prepare .sqlite ? - If it is necessary to use external
tool, is there any FREE tool to make
.sqlite ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的问题1& 2 已经得到回答,但这里是第三季度的全面概述:
http://www.barefeetware.com /sqlite/compare/?ch
我个人使用一个名为 SQLite Manager 的(免费)Firefox 插件 - 您可以从这里下载它 https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/
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/
那么,当您创建核心数据堆栈并将存储设置为 SQLite 存储时,持久存储协调器将创建一个为附加到存储的模型配置的 .sqlite 文件。
在 iOS 3.0 之前,您无法使用 Core Data,因此有几个库可用于使用 SQLite。然而,我认为它们中的任何一个都没有更新,因为使用 Core Data 时没有太多意义。
SQLite 是 标准,作为 MacOS X 的一部分 因此您可以使用命令行或脚本语言(如 Ruby、Python、Perl(也是标准的))来创建您想要的任何 SQLite 数据库。
但说实话,我不会打扰。除非您的应用程序的数据非常简单且大部分是静态的,否则您最终将重新发明轮子并有效地复制大部分核心数据,只是为了将 SQLite 与应用程序的其余部分连接起来。
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.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.
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 的 SQLite 结构实际上并不是为了由 Core Data 之外的任何东西处理而设计的。即使您的持久存储使用 SQLite 数据格式,如果您在通用 SQLite 工具中打开它,您也将得到一个神秘的混杂物,其中没有任何您可以可靠地弄乱的内容。
我猜您的目标是在数据库中预先填充数据?正确的方法是编写一些“导入器”代码,读取您拥有的任何现有数据,并在持久存储中创建与这些数据相对应的对象。保留该持久存储的副本(也许在您的应用程序包中,将其复制到临时目录以进行写入),您就拥有了一个起始数据集。
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.