sql.js
sql.js copied to clipboard
IDBFS persistent backend example
As far as I understand sql.js no longer needs to export the whole database to persist data with this new backend!!!
https://github.com/kripken/emscripten/blob/master/src/library_idbfs.js
http://kripken.github.io/emscripten-site/docs/api_reference/Filesystem-API.html#filesystem-api-idbfs
We should add an example that sets up sql.js with IDBFS chosen, and then compare performance.
Yes, I've seen that too, and it's great.
But I don't really have time right now for adding this to sql.js.
Pull requests are welcome :)
Just an idea: I played a little bit with SQLite's sqlite3_vfs and sql.js: it is possible to implement a custom vfs and register, use it in sql.js. I tried it with test_demovfs.c. The idea is to create a idb_vfs for browsers that splits the sqlite file into chunks to store them in indexedDB and upon read/write requests loads the necessary chunks. Keeping a complete sqlite file and load/write each time seems not to make much sense. No sure though, if splitting is technically feasible and fast enough.
I am trying to port some cross platform code into WebAssembly .The code itself contains some logic to manipulate SQLite database and save it. Now the build succeeded but when run, I see issues about SQLite: The query to create tables run without error, but after that, the select query will fail with some error complain the file is not a database. I tried to just open the in-memory database, then everything works. So I think the problem is that currently the normal persist logic not work for emscripten's IDBFS. @lovasoa , can you help confirm this? @jvail , what's the status of your work? I'd love to contribute if needed.
Just disable memory map IO and now seems everything works.
@Hao-Yan AS far as I remember it works just fine in node if you mount the file system. I have not tried it in the browser yet.