- WebSQL (
window.openDatabase ) is an outdated web standard. But it is available in most desktop and mobile browsers. Most browsers implement the specification using SQLite. On Android, browsers and WebViews support WebSQL, as well as local storage and session storage from the first versions, as well as IndexedDB with KitKat.
Then we have that Android independently supports SQLite for use with the Java API as one of the main mechanisms for saving it.
Cordoba is special. The application works in WebView, so it should use WebSQL, but in Android, the plugin redefines the API and implants in new window objects, which can by default use a different implementation, and not the browser API.
So, in the Cordova application, when it loads, when you call openDatabase , you actually call the new function that Cordoba has placed in the Windows object, overriding the old standard one. From Cordoba documents :
Some devices already provide an implementation of this specification. For these devices, built-in support is used instead of being replaced with a Cordoba implementation. For devices without storage support, the Cordova implementation must be compatible with the W3C specification.
This quote is ambiguous and is no longer in the docs. For "built-in", they meant built-in support for WebSQL in WebView. The documents I'm linked to are old, from version 2.x. In these versions, Cordova didnโt execute a custom implementation by default if WebView didnโt support WebSQL (I think this never happened), or if the device was affected by error 16175 . The default implementation was to use the Storage.java plugin, which used the Java API to create the SQLite database. I read the latest sources and in new versions (3.x) they seem to always use WebSQLite.
Yes, both create a DB file, but the path to it will be different. In fact, you can open the same database from JavaScript code and Java code in your application.
The same type of database. SQLite is its own C-layer that manages the file structure. In fact, you can also use this native C API from a native Android application.
Cordoba / Phonegap uses SQLIte from the built-in support, if available (on Android, this).
Yes, they stay there.
Yes, there is a limit. Read more about here .
Mister smith
source share