[SOLVED] Getting the OUT of a MySQL stored procedure?
Hi, I’m trying to get the value of a OUT variable from a stored procedure with no luck.
I’m using the code from the docs: http://doc.qt.nokia.com/4.7/qsqlquery.html#approaches-to-binding-values
I’m new to SPs so this is my test one:
PROCEDURE `abc`(IN x INT, OUT y INT)
BEGIN
SET y = 11;
END
The code is:
- query.prepare("CALL abc(?, ?)");
- query.bindValue(0, "7");
- query.bindValue(1, 0, QSql::Out);
- query.exec();
- int i = query.boundValue(1).toInt(); // i is 65
I get this error: OUT or INOUT argument 2 for routine blah.abc is not a variable or NEW pseudo-variable in BEFORE trigger QMYSQL3
Thanks for any advice!
4 replies
You should use the code from:
http://doc.qt.nokia.com/latest/sql-driver.html#qmysql
You must log in to post a reply. Not a member yet? Register here!


