[PyQt] QSqlTableModel and submitAll

Michele Petrazzo - Unipex michele.petrazzo at unipex.it
Sat Dec 11 10:46:43 GMT 2010

Hi all,
I have a piece of code where I connect a sqlite db to a QSqlDatabase, I
pass it to QSqlTableModel set it to a qtableview.
The db has some foreign keys / unique feature that are honored by the
sqlite command line correctly.
All works except that the I save the modified table with the
db.submitAll, if there is errors, the method (correctly as documentation
said) return False, but the next db.lastError return me an SqlError that
hasn't an error inside and its type is 0 (NoError).
If I add/modify the record, via the qtableview, inserting right data 
(from the db logic), it save and the return value of the submitAll are 
(correctly) True.

Where I'm wrong?

PyQt 4.7.3


More information about the PyQt mailing list