I have a QSqlQuery as follows:
QSqlQuery q
("SELECT video.codVideo, video.codSupporto, video.title, SUM(availableNol) AS available FROM video INNER JOIN dvd ON (video.codSupporto=dvd.codSupporto) AND (video.codVideo=dvd.codVideo)
GROUP BY video.codVideo, video.codSupporto, title");
QSqlQuery q("SELECT video.codVideo, video.codSupporto, video.title, SUM(availableNol) AS available
FROM video INNER JOIN dvd ON (video.codSupporto=dvd.codSupporto) AND (video.codVideo=dvd.codVideo)
GROUP BY video.codVideo, video.codSupporto, title");
To copy to clipboard, switch view to plain text mode
Then I created a queryModel and a QSqlRecord called record..everything OK the table is correctly printed and I can retrieve almost all fields except the one called available which is a calculated one..I tried:
int disp = record.value(3).toInt();
qDebug()<<"available: "<<disp;
int disp = record.value(3).toInt();
qDebug()<<"available: "<<disp;
To copy to clipboard, switch view to plain text mode
but qDebug always returns 0 even if it is correctly printed in the table view.
Is it a problem retrieving calculated values in a query?
Bookmarks