分类: C/C++
2011-03-08 11:44:24
Returns the low-level database handle wrapped in a or an invalid variant if there is no handle.
Warning: Use this with uttermost care and only if you know what you're doing.
Warning: The handle returned here can become a stale pointer if the connection is modified (for example, if you close the connection).
Warning: The handle can be NULL if the connection is not open yet.
The handle returned here is database-dependent, you should query the type name of the variant before accessing it.
This example retrieves the handle for a connection to sqlite:
db = ...; v = db.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 ... } }