PDA

View Full Version : stored proc with QtSql



xyzt
16th February 2009, 12:56
Hi,
Is it possible to call stored procedures stored in MySql using QtSql ?

seneca
17th February 2009, 09:12
In oracle a procedure call with an in, inout and out parameter would be something as:


query->prepare("begin myProcedure(?,?,?) end;");
query->bindValue(0, "foo", QSql::In);
query->bindValue(1, 1234, QSql::InOut);
query->bindValue(2, 0, QSql::Out);
query->exec();

QString p2 = query->boundValue(1).toString();
int p3 = query->boundValue(2).toInt();

I'm not sure about MySQL, but I think the query syntax would instead be:


query->prepare("call myProcedure(?,?,?);");