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

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?

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 ?

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

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

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

The purpose is speed

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.

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?

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)

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?

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.

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.

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