简体   繁体   English

Phonegap DB选项,IndexedDB,SQLite?

[英]Phonegap DB options, IndexedDB, SQLite?

I am building a Phonegap App and need to store data in a database. 我正在构建一个Phonegap应用程序,需要将数据存储在数据库中。 I would like to be able to access this information offline, but sync it to the server too. 我希望能够离线访问此信息,但也将其同步到服务器。 I want this app to work across all platforms if possible. 我希望该应用程序在所有平台上都能正常运行。 I know that there are a ton of posts out there with similar questions but I cant find any that are relatively recent. 我知道那里有很多类似问题的帖子,但是我找不到相对较新的帖子。

I have done a ton of research on it but it has only confused me more. 我对此进行了大量研究,但这只会使我更加困惑。 I know IndexedDB is available on all browsers except IOS Safari now (but will be in IOS 8 http://caniuse.com/indexeddb and my app wont be completed till then probably) But I've heard that webSQL(SQLite) is better, but is of course depreciated. 我知道IndexedDB现在可以在除IOS Safari之外的所有浏览器上使用(但将在IOS 8 http://caniuse.com/indexeddb中使用,并且直到那时我的应用程序才能完成),但我听说webSQL(SQLite)更好,但当然会贬值。

Should I go with SQLite like Samuel's comment here? 我是否应该像Samuel的评论一样使用SQLite? He has a syncing plugin for it too. 他也有一个同步插件。 SQLite database on PhoneGap / iOS - More than 5mb possible PhoneGap / iOS上的SQLite数据库-可能超过5mb

Or with a Polyfill for IndexedDB as explained here? 还是使用此处介绍的Polyfill for IndexedDB? http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html

I also just came accross this library, has anyone used it? 我也刚来过这个图书馆,有人用过吗? It looks promising... http://pouchdb.com/learn.html 看起来很有希望... http://pouchdb.com/learn.html

Or something completely different? 还是完全不同的东西?

Also are there any plugins for syncing to a server? 还有没有用于同步到服务器的插件?

Thank you in advanced for any responses 在此先感谢您的任何回应

I wonder if anyone will answer this with certainty, I would also like to know that answer. 我想知道是否有人会肯定地回答这个问题,我也想知道这个答案。 Till now I would suggest the SQLite wrappers. 到现在为止,我建议使用SQLite包装器。 That samuel answer looks very promising. 这个塞缪尔的答案看起来很有希望。

Or you can use sqlite/websql and write the sync code by yourself using php or asp script. 或者,您可以使用sqlite / websql并使用php或asp脚本自行编写同步代码。

in case of developing for many devices and platforms. 如果针对许多设备和平台进行开发。 You must clear which technologie have the best support and which is future-proof. 您必须清除哪项技术获得最佳支持,哪项技术可以应对未来。

IndexedDB was the best way! IndexedDB是最好的方法! because it is future-proof. 因为它是面向未来的。 Actually the Cordova / Phonegap project use for iOS the older WebView and not the wkwebview! 实际上,Cordova / Phonegap项目在iOS中使用的是较早的WebView,而不是wkwebview! therefor the have only a readable indexeddb and you must use the pollyfil solution. 因此,只有一个可读的indexeddb,并且您必须使用pollyfil解决方案。 But its a matter of time, when the solve the problem. 但是解决问题是时间问题。

In other platform (Android/Win8 etc. ) the supports nativly indexeddb. 在其他平台(Android / Win8等)上,支持nativly indexeddb。 And it is very fast, if you know how tu use. 如果您知道tu的用法,它的速度非常快。

I Ended up going with LocalStorage. 我最终选择了LocalStorage。 It has good support and is easy to use. 它具有良好的支持,并且易于使用。 Also I am using MongoDB on the backend, so everything from front to back stays as javascript/JSON 我也在后端使用MongoDB,所以从前到后的所有内容都保持为javascript / JSON

http://caniuse.com/#feat=namevalue-storage http://caniuse.com/#feat=namevalue-storage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM