3

If you check here: http://cordova.apache.org/docs/en/3.3.0/cordova_storage_storage.md.html#Storage , the page clearly shows the Web SQL Database API is being used.

This Web SQL Database API is no longer being maintained as mentioned here: http://dev.w3.org/html5/webdatabase/

Moreoever, the PhoneGap solution for Web SQL Database API is not available on all platforms. On the other hand, they also mention that indexedDB is supported, but on a different set of devices.

Why haven they broken the cross platform norms and also used an API being deprecated?

Ravindranath Akila
  • 209
  • 3
  • 35
  • 45

2 Answers2

6

It's based on whether the native WebViews support those technologies. On iOS, there is no IndexedDB support, and who knows when that will change. On Android, I think it's only in WebViews for the latest version (it's been supported in Chrome for a while now). But Web SQL is supported on both Android and iOS, even though it is deprecated.

So Apple is really the one to blame for breaking cross-platform norms and using a deprecated API. Please complain to them and hopefully they'll eventually get their act together.

dumbmatter
  • 9,351
  • 7
  • 41
  • 80
  • 1
    I agree, but why not standardize the API and hide the underlying architecture? For example why not provide a Key/Value store across platforms, with backward compatibility and upgrade support? Isn't this what the project set out for? Being able to build platform independent? I feel, it is an attempt to "keep SQL support", which is broken. Why not deprecated it, and cater for a standard key/value or so store which can be used cross platform? I'm sorry for being blunt, but I like what Cordova is doing and I see it a bit messy here. "Who is to blame", is a unappealing path to tread – Ravindranath Akila Dec 20 '13 at 02:27
  • My guess would be it hasn't been done because it would be a lot of work and there isn't a huge demand for it. In my very unscientific estimate, most developers prefer Web SQL to IndexedDB and they aren't clamoring for the latter to replace the former. That being said, there are polyfills others have written for the IndexedDB API on top of Web SQL and you can use them, but they are slow and buggy. https://github.com/facebook/IndexedDB-polyfill/ https://github.com/axemclion/IndexedDBShim – dumbmatter Dec 20 '13 at 03:08
  • Thanks! I'm thinking of offering bounty to get a official answer. Might have as well gone on their mailing list B-) – Ravindranath Akila Dec 20 '13 at 09:07
  • @RavindranathAkila Before offering bounties you could start by accepting the answers. – momo Dec 11 '14 at 03:22
  • @momo which answer do you think is the right one? And why? :-) – Ravindranath Akila Dec 12 '14 at 03:41
  • @RavindranathAkila Personally I think this one is good. It answers the question of why is Cordova using WebSQL. IndexedDB is not yet supported on iOS UIWebView thus making it impossible for Cordova team to use it as the cross platform storage solution. They could probably have used WebStorage but the storage max size is quite limited as it is the functionality vs WebSQL or even IndexedDB. An alternative would be to use the SQLite plugin for Android/iOS/WP cross platform support. – momo Dec 12 '14 at 04:04
0

The reason is that Cordova is pushing the js calls into device native code, and all the devices use SQLLite as their main db technology, so hence the system calls from websql convert perfectly, unlike what would occur with indexedDB.

Scorpio
  • 31
  • 1
  • 3