-
Type:
Bug
-
Status: Closed
-
Priority:
P3: Somewhat important
-
Resolution: Done
-
Affects Version/s: 5.11.1
-
Fix Version/s: 5.12.0 Beta 1
-
Component/s: SQL Support
-
Labels:None
-
Platform/s:
-
Commits:5f9a0d64b324abb8bf9baffabd7accb61a83a7e7 (qt/qtbase/5.12)
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 ... } }