PDA

View Full Version : QSqlTableModel/ QTableView parsing queries to xml



lizi_85
3rd December 2012, 14:12
Hello,

This is my first post to this forum and I hope the problem I am asking for solution is explained clearly . I am using QSqlTableModel and QSqlTableView for viewing a table of the DB. The cached table model is what I was looking for, that's why I chose QSqlTableModel(are there any other models?). Now I need to parse to xml all the queries cached, once I do submitAll() - I have chosen OnManualSubmit as edit strategy. I tried to write a subclass of QSqlTableModel and overload insertRowInTable/updateRowInTable/deleteRowFromTable, but the cache is accessed by a d-pointer to a private class and I don't find another way to get the cached prepared statements for then parsing them to xml. Is this solution I have thought not possible?

I am looking forward to any replies.

wysota
4th December 2012, 10:41
Do you wish to serialize queries or their results?

lizi_85
4th December 2012, 10:54
I should send the queries to a server in xml format and not directly to the DB. The serialization of the results is handled by the server.

wysota
4th December 2012, 10:56
I should send the queries to a server in xml format and not directly to the DB. The serialization of the results is handled by the server.

So essentially you need to implement your own SQL driver plugin. See the QSqlDriver and QSqlDriverPlugin classes.