QT will QSqlQuery::lastQuery() still show placeholder after addBindValue() being run?

Viewed 10

I got "Wrong key or corrupt data" error when executing a query in my code, so I inserted a debug line before the execution of the query to see what it looks like. I used QSqlQuery::lastQuery() to get the query text.

The query looked fine except the WHERE clause:

  SELECT ... FROM patient WHERE "idx" = ?

And the debug line happened right after QSqlQuery::addBindValue() was executed to replace the placeholder ? with the real idx value.

I suspect addBindValue() somehow didn't work but I want to be sure. Is it possible lastQuery() still returns the query with placeholder in place even though addBindValue() has been run?

0 Answers
Related