B4J Question [SOLVED] SQLite2WebSQL / SQLite2IndexedDB

Mashiane

Expert
Licensed User
Longtime User
Ola

I need a wizard please *no pun intended.

Lets say you have a SQLite db, you want to access this thing from a webapp (no websockets/no server), it should be embedded inside your web app. One approach is to convert this thing into a js file including the CREATE scripts, data etc and perhaps minify this nicely and then when your app starts, checks if the db exists, if not create it and then add the records if any and then open it.

So, if you think you can advise or have something existing please hola at me.

1. A B4J code snippet to convert the sqlite db to a js file in rather WebSQL / IndexedDB . This js file can then be added as part of my index.html script file.
2. A js snippet to get the db object, see if either a WebSQL/IndexedDB already exists or not, if not create it and then add the records. It can have an option to recreate the WebSQL/IndexedDB

Thanks...

#ListeningOnTheRadio
 
Last edited:

Mashiane

Expert
Licensed User
Longtime User
How is a webapp without server? You want a static webpage with database capabilities?

Well, I am not 100% sure what you need. But my recommendation is to use in ram database. Of course you still need a server.

https://www.sqlite.org/inmemorydb.html
Thanks for the response, yes a static webapp with database capabilities whether the db is WebSQL or IndexedDB. Please see point 1 and point 2 of my thread, that is what I need. Your proposed solution wont work sadly, however thanks.
 
Upvote 0
Top