Phonegap:WebSql或SqLite? [英] Phonegap: WebSql or SqLite?

查看:177
本文介绍了Phonegap:WebSql或SqLite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用phonegap很少的时间,我对它的存储概念有一些麻烦。



所以,文档说,是你可以打开的数据库,它是一个SQLite实现。window.openDatabase返回一个新的Database对象。



这个方法将创建一个新的SQL Lite数据库,返回一个Database对象,使用数据库对象来操作数据。
http://docs.phonegap.com/en /2.2.0/cordova_storage_storage.md.html#Database
我现在使用它在我的web应用程序:
var myBuggedDb = window.openDatabase(shortName,version,displayName,maxSize) ;



它的作用就像一个魅力。我可以使用它来进行查询,从选择到删除。好吧,对吧?但是当我检查和调试我的代码,我看到创建的是一个WebSql数据库。我也咨询了很多博客,wiki的和其他地方得到更多的信息有关的话题。它看到很多人做了两个技术的混乱。 Phonegap插件页面甚至没有sqlite插件。



现在,我们将改变我们的应用程序,因此它需要从localStorage一个JSON对象并转换它。我想把它插入我们的数据库。但现在我很困惑,我不知道这是webSql还是SQLite。有人可以澄清吗?它将在设备上作为SQLite还是作为WebSql工作?



编辑:如果你在未来寻找这个问题,已经改变了很多,indexedDB支持正在增长,还有很多其他选项,如Lawchair等。在使用任何东西之前做一些研究!

解决方案

HTML 5有这个数据库的实现,实现是通过嵌入Sql Lite数据库



浏览器像chrome和Safari有使用sqlLite实现的Html5数据库实现,称为websql,但是当我联系时,Mozilla没有实现Websql



更好的选择我认为是使用Backbone.js或Lawnchair虽然在内部都使用websql,但API包装一切为你。 / p>

希望这有助于。


I have been working with phonegap for little time, and i'm having some trouble with the concept of storage in it.

So, the documentation states that there is this database that you can open, and it is a SQLite implementation."window.openDatabase returns a new Database object.

This method will create a new SQL Lite Database and return a Database object. Use the Database Object to manipulate the data." http://docs.phonegap.com/en/2.2.0/cordova_storage_storage.md.html#Database I'm using it at my webApp right now: var myBuggedDb = window.openDatabase(shortName, version, displayName,maxSize);

It works like a charm. I can use it to make queries, from selects to delete's. All good, right? But when i inspect and debug my code, i see that what is created is a WebSql database. I have also consulted a lot of blogs, wiki's and other places to get more info about the topic. It seens a lot of people make a mess out of both techs. Phonegap Plugin page doesn't even have the sqlite plugin.

And now, we are going to change our app so it takes from a localStorage a JSON object and converts it. I want to insert it into our database. But now i'm confused, i don't know if this is webSql or SQLite. Could someone clarify? Will it work as a SQLite or as a WebSql after all, on the device?

EDIT: If you are looking for this question in the future, tread carefully: The technologies have changed a lot, indexedDB support is growing, there are many other options as well, like Lawchair and such. Do a little research before using anything!

解决方案

HTML 5 has this implementation of databases and the implementation is done by embedding Sql Lite database in to browser.

Browser's like chrome and Safari have there implementation of Html5 databases implemented using sqlLite termed as websql but when I was in touch, Mozilla wasn't implementing the Websql instead they were implementing Indexed DB.

Better option I think is to use Backbone.js or Lawnchair although internally both of them use websql but the API's wrap everything for you.

Hope this helps.

这篇关于Phonegap:WebSql或SqLite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆