How can I check if QSqlQuery::addBindValue()
has failed? For example, there might not be any more placeholders left to be bound. Consider this code:
QSqlQuery q;
q.prepare("INSERT INTO table1 (field1) VALUES (?)");
q.addBindValue("value1");
q.addBindValue("value2"); // this one should fail
However, addBindValue()
is a void
, so it doesn't return information about whether it succeeded or failed.
I finally stepped into the sources, and it seems you really can't find out if it has failed. It doesn't set the last error or any other error code: