PDA

View Full Version : QSqlTableModel subclassing and query synchornization



Itzuke
22nd December 2011, 15:07
Hi, what's the best way to implement SELECT FOR UPDATE, because it's not supported in QSqlTable model.
I'm using PostgreSQL 9, Qt 4.7.4 - MinGW.


Update:
Now that I gave it some thought, I think I have an easy solution:

1. Use a QSqlQuery to exec "SELECT FOR UPDATE..."
2. Check if result is ok and perform UPDATE, else try again or fail (or handle the situation in some way)
3. Get the result of the query and set it to the model via setData(...).