问题描述
我正在使用Qt5访问MySQL数据库.使用QSqlQuery + prepare()+ bindValue()可以很容易地执行INSERT查询.
I am using Qt5 to access a MySQL database. It is easy to execute INSERT queries using QSqlQuery + prepare() + bindValue().
现在我注意到bindValue()有一个可选的paramType参数,可以将其设置为QSql :: Out和QSql :: InOut.
Now I noticed that bindValue() has an optional paramType parameter that can be set to QSql::Out and QSql::InOut.
在调用过程时,QSql :: Out和QSql :: InOut参数是否有用并且对SELECT语句无用,是否正确?除了CALL之外,还有其他用例吗?
Is it correct that the QSql::Out and QSql::InOut arguments are useful when CALLing procedures and that they have no use for lets say a SELECT statement? Are there other use cases than CALL?
推荐答案
事实证明,QSql :: Out和QSql :: InOut实际上仅用于过程调用.
It turned out that QSql::Out and QSql::InOut are actually intended for use with procedure calls only.
但是,事实证明Qt/MySQL参数绑定不支持上述的OUT和INOUT参数类型(请参见).
However it also turned out that Qt/MySQL parameter binding does not support the mentioned OUT and INOUT parameters types (see here).
这篇关于QSql :: Out和QSql :: InOut是否在调用存储过程之外使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!