Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.11.1
-
None
-
-
5f9a0d64b324abb8bf9baffabd7accb61a83a7e7 (qt/qtbase/5.12)
Description
There is following invalid example code in following page:
http://doc.qt.io/qt-5/qsqlresult.html
QSqlQuery query = ... QVariant v = query.result()->handle(); if (v.isValid() && qstrcmp(v.typeName(), "sqlite3_stmt*")) { // v.data() returns a pointer to the handle sqlite3_stmt *handle = *static_cast<sqlite3_stmt **>(v.data()); if (handle != 0) { // check that it is not NULL ... } }
it should be something like this:
QSqlQuery query = ... QVariant v = query.result()->handle(); if (v.isValid() && (v.typeName() == QString("sqlite3_stmt*"))) { // v.data() returns a pointer to the handle sqlite3_stmt *handle = *static_cast<sqlite3_stmt **>(v.data()); if (handle != 0) { // check that it is not NULL ... } }