how to use sqlite with quasar vue



  • is there any documentation on how to use sqlite or sqlite3 with quasar vue? Alternately is can anyone point me to a compatible client-side database to use instead?

    Many thanks



  • @Charlotte sure, as for now, the low level DB in browsers is IndexedDB- tons of articles:

    https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

    However it is NOT compatible with sqlite.

    If you want to use IndexedDB you would probably be better off with some kind of wrapper. Those wrapper make use of IndexedDB easier. Here is one for example:

    https://dexie.org/

    Well, truth be told, you HAVE a compatible sqlite implementation in browser - it is called WebSQL BUT it is deprecated, not supported, dropped and available on chrome, opera and safari. Firefox and IE does not support it. I wouldn’t recommend using this.

    https://en.wikipedia.org/wiki/Web_SQL_Database

    There is always local storage, supported by Quasar.

    There are tons of libraries, which gives you some kind of storage, queries, client side and synchronize with the backend. For example:
    https://pouchdb.com/
    https://rethinkdb.com/

    There are cloud databases with local helpers for example:
    https://www.couchbase.com/

    And of course you have a big ones like fire something or azu something 🙂

    On the other hand - just remember that ANYTHING you can store client side in browser is NOT permanent! User, or browser can delete all data unexpectedly. I do not know your requirements, but honestly, clean and pure client side SQL db is in my opinion VERY rare use case. Please elaborate what you want to achieve?



  • Hi qyloxe - many thanks for your very helpful reply! I’m new to this world of client-side dev and am wrestling with my first quasar vue app. Im working on a “proof of concept” - rewriting an IOS app I wrote in the Apple app store but this time in quasar vue. Ive not come across browser based databases before. I take on board your warning that clientside browser db is not permanent. This makes stand-alone IOS apps challenging. I’m going to play around with this technology. Many thanks again. Charlotte



  • @Charlotte - Is your target actually a web browser for your rewritten app? If yes, this isn’t making sense to me.

    This makes stand-alone IOS apps challenging.

    Scott



  • Hi Scott,

    My initial ios app was, as you’d assume, a native app written first in Objective C (ugh!) and then re-written in swift. I guess my current one, if I use quasar vue and Cordova would land up being a browser based ios app - unless I use nativescript-vue. To be honest, I’m pretty swamped with absorbing and integrating the vast amount of new technology I’ve had to surmount in moving from what now seems to be the very safe circumscribed world of completed executables. So, forgive me if I sound muddled - I probably am! Charlotte



  • Ok. Now it makes more sense.

    As @qyloxe mentioned, from my experiences of lurking the Internet, PouchDB seems to be getting the most attention. But, I’m no expert. 🙂

    https://pouchdb.com/adapters.html

    Scott



  • Just had a look at the url you posted. Very helpful indeed. Many thanks.


Log in to reply