sql-js / sql.js

A javascript library to run SQLite on the web.
http://sql.js.org
Other
12.78k stars 1.06k forks source link

generate db file #6

Closed RayoGundead closed 10 years ago

RayoGundead commented 12 years ago

[question] can this be used to generate a db file that can be opened by sqlite(c/c++, php, etc.)?

kripken commented 12 years ago

I don't know if anyone tested, but in theory you can pull the file out of the emulated filesystem and save it locally. Should work in theory.

RayoGundead commented 12 years ago

so the return value of .exportData()?

danlangford commented 11 years ago

@gundead222 yes i have used the output of exportData() to create a sqlite file that can be used by other programs. done 100% client-side. [file tested with firefox add-on SQLite Manager ].

i have also been able to consume a sqlite file generated from exportData() or generated from SQLite Manager.

kudzo commented 11 years ago

@danlangford can you expand on that (consuming an external db file)?

danlangford commented 11 years ago

@kudzo using some fun HTML5 apis (drag-n-drop, blob, FileReader) i was able to take a sqlite db file created by another program and drag it onto the webpage and read the sqlite file with this sql.js.

im interested to see how it works with larger more complex files. i was testing with very simple sqlite files.

a ROUGH example can be seen here: code: https://github.com/danlangford/sea-lion/blob/v0.0.1-blob/app/js/sea-lion.js demo: http://sea-lion.herokuapp.com/

i hope to take these principles and build something cool. but until then....

update: i just tried the demo and its busted. i think i have code not yet pushed up to github. ill report back once i fix it update: BlobBuilder was removed from Chrome. demo works again [at least on Chrome]. good luck

kudzo commented 11 years ago

Cool stuff, but won't work for me, if i understand it correctly it reads the DB and copies it into the local db in the browser..what i need is multiple users connecting to the same DB at the same time. Currently i am using a sqlite connector because i will be using it in a hta file..but then the users need to register the dll..(there is a demo hta in the zip)

Connector: https://www.assembla.com/spaces/litex/documents/ci_8Yib6ar3AVDab7jnrAJ/download/ci_8Yib6ar3AVDab7jnrAJ

danlangford commented 11 years ago

My rough demo was 100% client side only. No server communication so not ideal for multiuser collaboration. I can't help you there. However I would challenge the use of sqlite in that manner. With free deployments on heroku and free db space on mongolab those tools might be better suited for multi user db access.

However that's prolly a conversation for another space. Feel free to ping me on Twitter @danlangford if you want to brainstorm ideas to solve your problem.

lovasoa commented 10 years ago

Yes, you can save the result of db.export() to a file, and open it with another sqlite library.