PDA

View Full Version : Qt4 Mysql stored procedure



lynnH
27th April 2010, 17:43
I am trying to call a Mysq 5 stored procedure from a Qt4 application.
I am doing something like the following:

QSqlQuery query2 = QSqlQuery();
bool queryStatus = query2.exec("CALL toto()");
int numRows = query2.size();

I get queryStatus set to true, but the number of rows is completly wrong (4294967295) and query2.isSelect() returns false.

Calling a simple request works perfectly.

I have spent several hours, any help is more than welcome.

Lynn

norobro
27th April 2010, 20:22
I created a stored procedure with a "select/where" statement and your code works fine here.

Does "call toto()" work from the command line of your MySQL shell?

lynnH
28th April 2010, 08:05
>>Does "call toto()" work from the command line of your MySQL shell?
Yes it does.

As my program is currently a test, I have before the stored procedure test another database connexion test (a simple request which works). If I use the same QSqlQuery for both but create a new variable to hold the size of the result (numRows2), the call to query.lastQuery returns "CALL toto()" but the call to query.executedQuery return the previous request (which was successful), and numRows2 returns -1 (which is coherent). Nevertheless, the return of the exec function is true and the query.lastError() does not return anything.

All this is really weird. I guess it is not a MysqlDriver issue otherwise no request would have worked.

Lynn