Count rows in QSqlQueryModel?
Is there a way to count the amount of row a QSqlQueryModel holds without iterating through each record to see if it exist or would I be better off just making an additional QSqlQuery?
I thought rowCount() would work but it has simply confused me.
If your database supports the QSqlDriver::QuerySize feature you can use rowCount() directly (otherwise it just returns the number of cached rows).
If not, having a dedicated COUNT query might be the most performant solution.
I will give you an advice to search before posting - there were many posts here about it.
@Lukas Geyer Thank you. I'll have to look into this but sounds like something that could be preventing this from working the way I thought. I have never worked with MySql, so I will have to read more on it. For some reason I have a feeling I will like the iteration time with a query but I also have to consider poor network speeds also.
@tucnak Please don't respond to my post if they bother you. If you would like to please prove your point because I have looked. Provide a link to one of these many post. Should be easy as 1,2,3; right!
The MySQL driver should support QSqlDriver::QuerySize, so rowCount() should return the number of rows in the current query.
@Lukas Geyer Thank you very much for your response again, your wisdom is vast.
I still haven't come back to this but that is disconcerting because this means I am passing data wrong somewhere most likely if it isn't feeding me right. Will keep you updated when I come back to it I already have a idea what I need to do. Right now I am focusing on porting code to other OS's, fun...