Example
q is your QSqlQuery instance;
if (!q.exec())
{
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) {
// v.data() returns a pointer to the handle
sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
if (handle != 0) { // check that it is not NULL
qDebug("Error: %s", sqlite3_errmsg(handle));
}
}
}
if (!q.exec())
{
QVariant v = q.driver()->handle();
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) {
// v.data() returns a pointer to the handle
sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
if (handle != 0) { // check that it is not NULL
qDebug("Error: %s", sqlite3_errmsg(handle));
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks