SQLite to IndexedDB ... or wait?

I have a couple of apps that use SQLite and since they are only run as web apps saved to home screen they of course don’t work on an iPhone. For now I’ve disabled the database features.

My question is, should I be moving to IndexedDB (which seems overly complex) or should I wait a future version of Appstudio that may implement some sort of wrapper library? It woulld be nice to get my database functions back up and working within the next 3-4 months.

Bob

For native iOS and Android apps built with VoltBuilder I use
<plugin name="cordova-sqlite-evcore-extbuild-free" source="npm" />

Thanks.

I understand that if I build a native app that I can get around the problem. I’m a ways off from producing native apps though so just wanting to know if George and the gang will have a library to be able to use SQLite in a web app, saved to home screen, on an iOS device.

Just hoping to stay away from IndexedDB :slight_smile:

Bob

There is a library which allows the use of SQLite in the browser, but from a preliminary look, changes may be needed to your code. It’s on our todo list to have a closer look, but we’re a bit backed up right now.

If anyone is interested in diving into using this, let us know. We’ll be happy to give all the help we can. It will all be JavaScript.

Back a few years ago I moved one of my apps from SQLite to IndexedDB. This particular app used the DB extensively. The entire port took about a week. It took a bit to get my head around what they were doing in IndexedDB but once I got it (2-3 days in), it really went very well.

If you’re gonna eventually move to a cordova app, I’d not port to IndexedDB as it would be a wasted effort UNLESS, of course, your users are demanding the features that come with the DB. If you do port, just know that IndexedDB suffers the same problem as localStorage and cookies… when the device gets really low on space iOS has a cleanup process that removes these files starting with lesser used apps and moving forward.

Thanks Phil.

Probably best to start learning IndexedDB now as I’ll likely be needing it for my next project. It would have been nice to have a few more App Studio samples.

Bob

Since when WebSQL got deprecated I moved to IndexedDB through PouchDB. It is a Javascript implementation of CouchDB, which is a NOSQL database with built-in replication (PouchDB also supports SQLite as a backend for native Cordova/VoltBuilder apps).

The API is very friendly, there is plenty of documentation out there and it is actively mantained in GitHub.

What I like about it is that I could easily setup a CouchDB server and have all instances of my app synchronized without any effort. When I run it from my iPhone, Android or Windows device, I get the same view of the data, which I find to be really cool.

Happy to discuss the lessons learned when changed from a SQL to NOSQL mindset. Once you get it, coding is a breeze.

I created this project which “reads” sql commands and writes the data to an IndexedDB file.
It’s pretty crude as it only does read, write, drop table,createtable etc. No fancy database calls but anyone is welcome to use this.

I used jsstore.js library to simplify the IndexDB commands a little.
The idea was to implement it in to my existing projects by simply changing the SQL call Sql(SafeDB, sqlList) to SQLListToIndexedDB("SafeDB", sqlList).

I haven’t continued with it as I’m still not aware if IndexDB is outside of the localstorage area. Does IndexDB data persist after a cache clear?

SQLToIndexedDB.zip (65.0 KB)

I don’t think it persists. Fun fact: I hear that in all browsers except Chrome, IndexedDB is actually implemented using WebSQL (SQLite).