PhoneGap上的SQLite数据库 [英] SQLite database on PhoneGap
问题描述
我想使用PhoneGap为iPhone实现SQLite数据库。我知道一些基本的SQLite数据库在iPhone本机应用程序。但是如何在PhoneGap中实现SQLite数据库?
I want to implement SQLite database for iPhone using PhoneGap. I know some basics SQLite database in iPhone native application. But how can I implement SQLite database in PhoneGap?
推荐答案
重要的是要记住PhoneGap是<浏览器组件。适用于移动WebKit的所有内容也将应用于PhoneGap,PhoneGap中的环境也非常类似于在桌面浏览器中打开HTML文件。
It's important to remember that PhoneGap is web apps packaged in a browser component. Everything that applies to mobile WebKit will apply to PhoneGap as well, and the environment in PhoneGap is also very similar to opening an HTML-file in a desktop browser.
所谓的Web SQL数据库。
You want what's called a 'Web SQL Database'.
http:// www .w3.org / TR / webdatabase /
修改:此规范已标记为已弃用
实际上,它是基于SQLite在支持它的大多数浏览器,但是,它不会完全 SQLite实现。但它接近。在Chrome或Safari中,您可以使用开发人员工具查看其内容,查看资源选项卡 - >数据库(您要在尝试PhoneGap之前在桌面浏览器上测试基本功能)。
In reality, it's based on SQLite in most browsers that support it, but it won't be exactly the SQLite implementation. But it's close. In Chrome or Safari, you can go have a look at it's contents with your developer tools, look at the 'Resources' tab -> Databases (you want to test out basic functionality on a desktop browser before trying in PhoneGap).
它在PhoneGap中的工作方式与桌面浏览器中的完全一样。
It will work exactly the same in PhoneGap as in desktop browsers.
Web SQL数据库是更广泛的称为本地存储。我认为关于这个话题的最佳介绍文字可以在Mark Pilgrim的Dive into HTML5中找到:
Web SQL databases are one implementations of what's more broadly referred to as "local storage". I think that the best introductionary text on that topic can be found in Mark Pilgrim's "Dive into HTML5":
http://diveintohtml5.info/storage.html
仍适用于PhoneGap和桌面浏览器。
Still just as valid for PhoneGap as for desktop browsers.
这篇关于PhoneGap上的SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!