B4J Question SQLite2WebSQL / SQLite2IndexedDB

Discussion in 'B4J Questions' started by Mashiane, Sep 14, 2018.

  1. Mashiane

    Mashiane Expert Licensed 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: Sep 14, 2018
    joulongleu likes this.
  2. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed 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
     
    Mashiane likes this.
  3. Mashiane

    Mashiane Expert Licensed User

    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.
     
    joulongleu likes this.
  4. Mashiane

    Mashiane Expert Licensed User

  5. Don Oso

    Don Oso Active Member Licensed User

    you can use Nosql with the Browser localStorage, its a key value storage with limited capacity but works if you store json structures.
     
    Mashiane likes this.
  6. Mashiane

    Mashiane Expert Licensed User

    Thanks Don, but for me that is not the option I need right now.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice