How to put a web SQLite database on the client side?

  1. 4 weeks ago

    John S

    Oct 20 Pre-Release Testers, Xojo Pro

    Not sure I quite understand this: If I assign an SQLite database in Session does it put the database on the client side? If not, can I put a database on the client side?

  2. Barney

    Oct 21 New Zealand

    Hi John, I'm not aware of it going to the client side ? The SQLite file would normally reside on the server.

    Why do you want to put a database file on the server side - what are you trying to do ?

  3. Greg O

    Oct 21 Xojo Inc scout.galaxy.barn

    @John S Not sure I quite understand this: If I assign an SQLite database in Session does it put the database on the client side? If not, can I put a database on the client side?

    You can’t. The web browser makers shied away from WebSQL in favor of IndexedDB to prevent reliance on a particular technology unfortunately.

  4. Edited 4 weeks ago

    You could take a look at Google's Lovefield
    or sql.js which is a port of SQLite to Webassembly.

  5. Rick A

    Oct 21 Pre-Release Testers (Brazil. GMT-3:00)

    @Steve W Google's Lovefield

    Not a SQLite "client side", but a persistent, in-browser DB, at client side, for sure.

  6. John S

    Oct 21 Pre-Release Testers, Xojo Pro

    The purpose is speed

  7. Markus R

    Oct 21 Pre-Release Testers, Xojo Pro Europe / Germany

    i believe spider basic use a memory db and then in can save/load it in to browser cache sandbox. (non persistence at all)

  8. @Markus R i believe spider basic use a memory db and then in can save/load it in to browser cache sandbox. (non persistence at all)

    It uses sql.js (as I linked to above) when you compile a web app or SQLite if you're compiling for Android / iOS.
    With web apps it's only persistent until the user clears their browser cache, with Android / iOS then it's truly persistent in a local SQLite file.

  9. Greg O

    Oct 22 Xojo Inc scout.galaxy.barn

    @John S The purpose is speed

    Keep in mind that you’ll have to do everything custom. All of our controls assume that the data is coming from the server.

    Could you explain what you’re doing that you need this?

  10. John S

    Oct 22 Pre-Release Testers, Xojo Pro

    As I said speed; so that the program can get information from the client computer instead of constantly sending an sql command to the server.

    I think that will speed things up . . . Am I wrong? (remember, knowledgeable amateur here, not like you professionals)

  11. 2 weeks ago

    John S

    Nov 8 Pre-Release Testers, Xojo Pro

    Idea: Do SQL Select and put the results in arrays, then get the data from the arrays instead of SQL Selects.

    Will the arrays be on the client side or there still be communication to the server?

    Would this speed things up?

  12. last week

    Kyryl P

    Nov 10 Pre-Release Testers, Xojo Pro Europe (Ukraine)

    @John S Would this speed things up?

    I think no.

    Perhaps, you can try to put the array in Cookies. I'm still not sure that Xojo will not send it to the server on fetch. It should be tested.

  13. Ricardo C

    Nov 10 Pre-Release Testers, Xojo Pro https://rcruz.es/

    Uhm, I think the problem is we're proposing solutions to a problem we don't know. What's the actual speed issue you're trying to resolve John?

    If you cache database results into arrays (that will live in the server), then you will have to figure out how you'll invalidate the cache when needed. Put the cached array into cookies, and you'll end up reaching the browser's cookies size limit sooner or later.

    Speeding up an application needs a profiling analysis. You can profile the server side using fantastic Xojo's tooling, or the Browser's Developer Tools for the client side. Write down a list of the performance issues you've detected, estimate the effort on fixing them. Then you'll be able to just attack the less effort/most impact solution. Rinse and repeat.

    For example (just an example I don't know your issue), maybe you're trying to put the DB into the client because the queries you're doing are CPU intensive and you're running out resources on your server, so you can offload the effort to the clients. The solution instead may be adding an index here or there, rewriting the query, using a materialized view, etc.

  14. John S

    Nov 10 Pre-Release Testers, Xojo Pro

    The array would be on the server side . . . Thanks

or Sign Up to reply!