简体   繁体   中英

reading & writing sqlite database with javascript

I am currently trying to get my head around database's and web programming. I currently have 3 files index.html, script.js (empty at the minute) and test_db.sqlite. I am trying to pull info from the sqlite database, create a javascript variable with the info and the print it to the html with the document.getElementById method.

What I'd having trouble with is reading the database using javascript. I am willing to use jquery or any other extra JS scripts, but I cannot use php as I intend to use this to create a cross platform app with a python web wrapper on windows & linux and phonegap for iOS and Android.

I also need to figure out to write to the database with javascript.

Thank you for any help in advance.

  1. You have to dump the database (you can use .dump command in sqlite3)
  2. Then you can send that dump to de front-end (the navigator)
  3. You can use WebSql API to create the database and execute all commands of the dump to recreate

Warning, this does'nt work in Firefox. It works only in Chrome and Safari

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM