PDA

View Full Version : QSqlTableModel + QSqlQuer + veird behavioure for the match



Talei
16th November 2013, 17:16
Hello,
I have issue with QSqltableModel and QSqlQuery (db Sqlite3, model edit strategy onManualSubmit):
situation:

QSqlTableModel - table with i.e. 3 columns, N - rows (rows 20) and now from other place in the code I do QSqlQuery with "UPDATE" to 1 row (change only last column)
now in other place of the application I do QSqlTableModel -> match() - it do get me data that I want.

Now repeating above process for same row and QSqlRableModel match() - DONT find any items. I do then QSqlTableModel -> data() and no data is returned.
Of course nothing was changed at above process with QSqlTableModel and I dont care about data that is updated by QSqlQuery.

So now I do detection if data returned by QSqlTableModel is empty() and then I can do QSqlTableModel -> select() and now match() and data() works fine.

So now question why data gets "invalidated" for the row? AFAIK QSqlTableModel and QSqlQuery are not connected in any way and QSqlTableModel do store its data in internal cache etc. so match() or data() should give ma an result (of course not updated - but I don't use modified column in model).

Any info more then welcome.