Question

My question is about IndexedDB vs. WebSQL vs. SQLite. There is no need to explain that they are different, what I would like to know is:

Do those three "Database Solutions" allow for storing all its Data to a file?
(and of course to do the reverse, initialize all its data given a backup file?)
.

Background

Since I already have done some research, which partly answers this question, allow me to provide this background info to the question:

SQLite

(yes it does allow storage and retrievel of the Database to and from a file)
I have already done some work with SQLite. For this I know that there it actually right away starts the database via a reference to the file. Backup is simple copying the file. Restoring is rewriting the file.

IndexedDB and WebSQL

??? Are to my understanding Database Solutions which "life their life in the Browser's Javascript land" and there we do not deal much with files. Here is part of where the question lies. If I wanted to export the data from either of the two solution to a flat file or lets say a one string variable representation, would that be possible?

This are some SO question I think that relate to it:

which indicate that there is no easy toString() (Store Database) method and FromSting() in IndexedDB nor in WebSQL. It indeed true (and affirmed in an answer here) and there is not easy backup and retrieval for those Database, this would be very sad, and I think a gap. Databases without backup function, really?!

Was it helpful?

Solution

At Present, there is no way to back up and restore Browser databases. The only way you can achieve this is by continuously syncing your back-end database with the browser database and thus keep track of changes in data generated on browser.

OTHER TIPS

Old guy will do in old way, whether appropriate or not. How on earth, browser database need a backup. Data in the client is just cache copy of a slice of server data. There is no need back. If you think IndexedDB (or web sql database) data is durable, you will be glad to know, IndexedDB data belong to a temporary class of browser data, meaning that UA can delete data at their discretion without prompting to user or app.

If your app treat browser data more than cache copy, you are doing wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top