sqlite db 文件在任何平台下都可用吗?
例如,我可以生成一个SQLite db文件并将其作为资源放入项目中吗?当项目首次启动时,将数据库复制到独立存储中,而不必担心该数据库文件在手机中不可用。此外,我可以将这个空数据库文件复制到另一个平台,例如android或iPhone,并通过该平台的SQLite api操作这个数据库吗?
For example, can I generate a SQLite db file and put it as a resource in the project. When the project first launches, copy the db into isolated storage without worrying this db file may be unavailable in the phone. Furthermore, can I copy this empty db file into another platform, like android or iPhone, and operate this db by in SQLite api of the platform.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 SQLite 网站:
所以,是的,当您验证 SQLite API 在您想要使用它的任何地方都可用时,这应该可以作为一种存储格式。
编辑:是的,SQLite 可以在 Windows Phone 7 上运行,使用此 Codeplex项目或这个。
From the SQLite web site:
So yes, when you've validated that the SQLite API is available everywhere you want to use it, that should be fine as a storage format.
EDIT: And yes, SQLite does work on Windows Phone 7, using this Codeplex project or this one.
是的。我们在 iOS、Android 和 WP7 应用程序中使用相同的 SQLite 数据库。我在这里写了一个快速入门指南: http ://wirebear.com/blog/2010/11/12/using-sqlite-in-your-wp7-app
上述博客文章介绍了将数据库从资源复制到独立存储以及正确配置 SQLite在您的设备上工作。
Yes. We are using the same SQLite database in an iOS, Android and WP7 app. I've written a quick start guide here: http://wirebear.com/blog/2010/11/12/using-sqlite-in-your-wp7-app
The above blog post covers copying your database from your resources to isolated storage and correctly configuring SQLite to work on your device.
据我试验,SQLite 版本与 Android - iOS - WindowsPhone 兼容。我在 Mac 桌面上创建了 SQLite DB,并将其与数据一起复制到每个平台中的项目中。一切工作正常,没有任何问题。
参考:
http://www.sqlite.org/download.html
下载页面本身列出了不同平台的完整代码和二进制文件。使用 PC/Mac 创建数据库是一个方便的选择。
您可以使用 SQLite 管理器在 Windows 或 Linux PC 上执行此操作。
SQLite Manager(我自己首选)
http://sqliteman.com/
还有适用于 Chrome 和 Firefox 的扩展,这使得SQLite 几乎可用于任何平台来管理它们。
用于管理这些文件的 Firefox 插件。
https://code.google.com/p/sqlite-manager/
codev。它还允许编辑 SQLite 文件。
就 DB 而言,从设备导出它们正如 @Jon Skeet 所描述的那样
SQLite 3.7 与 Windows Phone 更兼容。由于 SQLite DB 向后兼容,因此无需担心您的 DB 是否可以在较旧的 2.x 版本或 3.x 上运行。
希望这会有所帮助。
The SQLite version is compatible with Android - iOS - WindowsPhone as far I have experimented. I have created SQLite DB on a Mac Desktop and copied it into projects along with data into each of these platforms. Everything worked fine no issues.
Ref:
http://www.sqlite.org/download.html
The download page itself lists the entire code and binaries for different platforms. Using a PC/Mac for creating a DB is convenient option.
You can use SQLite manager for doing so on a Windows or Linux PC.
SQLite Manager (Preferred by Myself)
http://sqliteman.com/
There are also extensions for Chrome and Firefox, which makes SQLite Available for almost any platform to Manage them.
Firefox Plugin for managing those files.
https://code.google.com/p/sqlite-manager/
codev.it also allows to enable editing SQLite Files.
As far as DB is concerned, Exporting them from the device is as described by @Jon Skeet
SQLite 3.7 is more compatible with Windows Phone. Since SQLite DBs are backward compatible, there isn't any need to worry weather your DB works on older 2.x version or 3.x..
Hope this helps.
@Bhuro 由于您想要在 Windows Phone 7 应用程序中使用 SQLite db 的详细过程,这里有一篇很好的文章 通过 Windows Phone 的 Sqlite 客户端进行本机数据库编程。
我已在 WP 应用程序中成功遵循相同的流程。尝试一下,如果您有任何疑问,请告诉我。
祝你好运 !!
@Bhuro As you want a detailed procedure for using SQLite db in a Windows Phone 7 app, Here is a good post Native Database Programming via Sqlite Client for Windows Phone.
I have successfully followed the same process in my WP app. Try that and let me know if you get any doubt.
Good luck !!