[odb-users] Web http client as database runtime
Tony Rietwyk
tony at rightsoft.com.au
Thu Sep 30 10:53:46 EDT 2021
On 30/09/2021 9:34 am, Adnan RIHAN wrote:
> Hi all,
>
> I'm writing a stock management app using Qt (currently, only a
> standalone version using QtSql and Sqlite), and I would like to
> support a "network mode". The easiest way I thought about would be to
> use an ORM like ODB and write a database runtime for web calls (GET
> calls for SELECT, POST/PUT for INSERT/UPDATE, DELETE for DELETE FROM, …).
>
> How would it be feasible to write a different runtime for ODB, and do
> you think it's a smart approach please?
>
> Thanks for your advices
Hi Adnan,
Not a direct answer regarding ODB, but I had to do something similar
with a large QtSql and Firebird app used by thousands of schools around
the world. I used a home grown QSqlDriver for several reasons:
- The app was too large to make any widespread changes.
- The app already switched between local and LAN based database
connections, so adding a third connection type was easy.
- The app was very pop-up dialog based, where lists of records were
modified in memory, then the insert/delete/updates for the altered
records were done in a single transaction when the dialog was OK'd.
This was really lucky and important, since none of the changes relied on
doing selects on altered information during the transaction. So the
updating SQL statements and bind parameters could be accumulated by the
driver and sent to the cloud server in one request during the 'commit'
routine. The select statements (usually done at the dialog start) were
simply passed through directly to the cloud server.
- Some of the select queries could return very large amounts of data -
mostly admin reports.
- Many students had very low-end laptops and Internet connections, so
reducing the amount of traffic to the cloud server used to be important.
It took several months of development, and remains private to that
client. There were tricky issues mostly around using a nested event
loop to block or delay UI interactions while accessing the network.
I hope you find this useful,
Regards, Tony
More information about the odb-users
mailing list