RealTime QxModelView

Use this forum to request new features or suggest modifications to existing features

RealTime QxModelView

Postby Bakhman » Tue Oct 01, 2019 3:44 pm

Hi Sir,

As I know in QxOrm library it is impossible to synchronize efficiently a QxModelView with a DBMS. In order to have up-to-date data One needs to clear the entire model and fetch all rows of database repeatedly. Or add some extra columns to a table like lastUpdatedTime but again go through all rows of a table and check that value. Obviously all these workarounds are not efficient and are time consuming.

To solve this problem I tried to use https://rethinkdb.com/, because this DBMS is RealTime and NoSQL(like mongoDB) but I couldn't find an official binding to C++. Then, I accidentaly found out that mongoDB also supports change events and this is done by Change Streams https://docs.mongodb.com/v3.6/changeStreams/.

So the question, is it possible to add this kind of synchronization to QxModelView?

Best regards,
Nurnazarov Bakhman.

*If the question is not clear or you have some other questions to me please write! I appreciate your response! ))
Bakhman
 
Posts: 2
Joined: Tue Oct 01, 2019 2:44 pm

Re: RealTime QxModelView

Postby qxorm » Mon Oct 07, 2019 8:10 am

Hello,

This is not a QxModelView specific issue : this problem is more general ==> How to get up-to-date database data displayed to user without having to request it every X seconds for example ?
Is it your question or am I wrong ?

I think the only way to do that is to find a database which is able to send an event when something has changed.
I didn't know about MongoDB Change Streams.
I can just say that MongoDB is now supported by QxOrm library.
So if you can register your code to receive an event when something has changed in MongoDB, then you should be able to refresh data displayed to user.
qxorm
Site Admin
 
Posts: 477
Joined: Mon Apr 12, 2010 7:45 am

Re: RealTime QxModelView

Postby Bakhman » Fri Oct 11, 2019 5:41 pm

Yes, you are right! I noticed MongoDB Change Streams just as an example. But as usual I haven't found any official c++ driver that supports it )). Because it's relatively a new feature for this DBMS.

After a little research I have realized that the best DBMS for real-time Qt applications is PostgreSQL.

Because:
1. It's robust and powerful.
2. Postgres has Publish-Subscribe functionality in the form of NOTIFY, LISTEN, UNLISTEN (can send JSON notifications also).
3. The most important - Qt PostgreSQL Driver supports it! )) [Qt > 5.0] [Asynchronous via Signal/Slot] [https://stackoverflow.com/a/38223492]

So it should be easy to add this great feature(in my opinion) to QxOrm, so that Qt applications would become ALIVE. :D
Bakhman
 
Posts: 2
Joined: Tue Oct 01, 2019 2:44 pm


Return to QxOrm - Feature request

Who is online

Users browsing this forum: No registered users and 0 guests

cron