HTML5 SQLite vs Native Database in case of PhoneGap

后端 未结 3 1982
清酒与你
清酒与你 2021-02-09 14:04

I am building a PhoneGap application for Android and iOS.

I want to know which one is a better selection for database management: HTML5\'s SQLite or Native database of

相关标签:
3条回答
  • 2021-02-09 14:45

    I don't know about native database, but HTML5 WebSQL is very slow on iPhone when using tables with hundreds of rows, mainly 3G, 4G is little better. On Android there is no problem running pretty nice queries - we thought it would be the same on iPhone but we had to drop use of WebSQL in our project and rewrite everything to JSON and many more functions which had functionality of a few simple WebSQL queries.

    It's a shame that support of WebSQL is officialy dropped, but currently, it's supported on both Android and iPhone and it's very handy for some cases. So I hope and I think WebSQL will be maintened "not-officially" but still in Android and iPhone in future.

    As for your question - my experience tells me, that it depends on your tables structure, how complex queries you have and mainly - how many rows you have in tables. If you have tens of rows, its OK to use WebSQL, but if you hit 100 or more rows in a table, it will get slow on iPhone.

    0 讨论(0)
  • 2021-02-09 14:51

    The Web SQL Database standard is no longer being developed. It will probably be replaced by IndexedDB. I wouldn't rely on its existence if I were you.

    From the spec:

    Beware. This specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further.

    0 讨论(0)
  • 2021-02-09 15:03

    i have tested with a POC that Native DB of Android/iOS is too much faster then WebSQL (of HTML5), in case of a PhoneGap App we should use a plugin for Native database. in my test; i have run 999 insert query in a PhoneGap App with Plugin for native environment and the results are:

    in Android queries are 558% faster in Emulator, 275% faster in htc droid hd and amazingly 2327% faster for htc wildfire.

    in iOS the results are just hilarious queries are 2k+ percentage faster in Simulator/iPhone 4 and 5600% faster in iPhone 3GS.

    0 讨论(0)
提交回复
热议问题