4 ms·
SQLite underpins large parts of both iOS and Android, so... all of them? Whether you can serialize "an entire database" just depends on the size of the database
by WJW 6y ago
SQLite underpins large parts of both iOS and Android, so... all of them? Whether you can serialize "an entire database" just depends on the size of the database and whether it will fit in the local storage. SQLite scales up to a few TB at least, so that is unlikely to be the bottleneck.
- yrrr 6y agolocalStorage is a web API, the storage limit is ~5MB. However it can only store strings so it's pretty taxing. Chrome and Safari actually embed SQLite directly as WebSQL, however it's not becoming standardized because Mozilla doesnt consider "add SQLite" as a sensible web standard.
- dheera 6y agoI don't fully get it -- this is an SQlite implementation in JavaScript, which is different from what you'd use in a native app. Unless you store it to localStorage or cookies, all variables disappear when you navigate away from the page. Can you write an offline HTML5 webapp with any of these libraries such that it can cerealize the entire database into a string and then store that to localStorage and reload the next time? It's an honest question and not sure why people are downvoting without giving reasons.
- tehbeard 6y agoReally you'd want to do this in to an indexeddb store rather than local storage. Less issues with size limits and string serialisation as you can chuck Blob instances straight into it. You'd have to handle loading/saving though
- kpkrish 6y agoIs there some way by which the indexedDB store can stay synchronised with the server database running in the backend. Something simple so that the front-end app developer can just focus on implementing business requirements.
- tehbeard 6y agoindexedDB is too low level for that kind of thing by itself. It's just a fast Key-Value store with secondary indexes that's in your browser. You either need to find a solution that has a sync system built in (such as <https://dexie.org/ https://dexie.org/> or <https://pouchdb.com/ https://pouchdb.com/> ) or you'd roll your own atop whatever you were using.