Sep 29, 2019 Replies: 1 Ola I needed to embed a sqlite db as part of a web app i'm working on, but as JavaScript / JSON. This app helps with converting your sqlite db to javascript. This is useful when one wants to use the data for READ ONLY purposes, my case in point. 1. Add the database that you want to be converted to the Files tab of the project 2. Pass the name of the database on "sqlite.db" 3. You have an option to include a. scheme, b. indexes. c. data and also generate individual js files for each table. 4. The output is saved under /Objects folder. This can then be moved to your relevant project, in my case my BANano based WebApp. Usage: Code: Sub AppStart (Form1 As Form, Args() As String) 'RedirectOutput(File.DirApp, "sqlite2json.txt") ' SQLite2JSON("sqlite.db",False,False,True,True) ' 'ViewFile(File.DirApp, "sqlite2json.txt") ExitApplication End Sub Code: 'open the database file Sub SQLite2JSON(dbName As String, bIndexes As Boolean, bSchema As Boolean, bData As Boolean, bSeparate As Boolean) Example output... Code: function GetBooksData(){ return Books.data; } var Books = { "data": [ { "chapters": "50", "bookname": "Book 1", "bookid": "1" }, { 4. Next I will include the js files (which will be minified) to my app and query with BANanoJSONJquery Ta! Attachments Sqlite2Javascript.zip Sqlite2Javascript.zip 3.1 KB · Views: 802 Click to expand...
Ola I needed to embed a sqlite db as part of a web app i'm working on, but as JavaScript / JSON. This app helps with converting your sqlite db to javascript. This is useful when one wants to use the data for READ ONLY purposes, my case in point. 1. Add the database that you want to be converted to the Files tab of the project 2. Pass the name of the database on "sqlite.db" 3. You have an option to include a. scheme, b. indexes. c. data and also generate individual js files for each table. 4. The output is saved under /Objects folder. This can then be moved to your relevant project, in my case my BANano based WebApp. Usage: Code: Sub AppStart (Form1 As Form, Args() As String) 'RedirectOutput(File.DirApp, "sqlite2json.txt") ' SQLite2JSON("sqlite.db",False,False,True,True) ' 'ViewFile(File.DirApp, "sqlite2json.txt") ExitApplication End Sub Code: 'open the database file Sub SQLite2JSON(dbName As String, bIndexes As Boolean, bSchema As Boolean, bData As Boolean, bSeparate As Boolean) Example output... Code: function GetBooksData(){ return Books.data; } var Books = { "data": [ { "chapters": "50", "bookname": "Book 1", "bookid": "1" }, { 4. Next I will include the js files (which will be minified) to my app and query with BANanoJSONJquery Ta!
tchart Well-Known Member Licensed User Longtime User Oct 1, 2019 #2 Very cool, thanks for sharing Mashy!