Am 14.08.2012 13:52, schrieb Constantin Makshin:
Don't use the undocumented QVariant::data() method designed for some
Qt's internal purposes. Use QVariant::value():

sqlite3* handler = v.value<sqlite3*>();

However, Scott's code fragment is almost identical to the one in the QSqlDriver::handle() documentation, so if this does not work, the docs should be updated...

Scott: Did you try something simpler than creating a function with the returned handler? I am not familiar with the sqlite API, but there should be some trivial call that would verify that the handler is valid. And does *handler look reasonable when viewed in a debugger?

On Mon, Aug 13, 2012 at 10:16 PM, Scott Aron Bloom
<scott.bl...@onshorecs.com> wrote:
{
     QVariant v = db.driver()->handle();
     if ( !v.isValid() || qstrcmp( v.typeName(), "sqlite3*" ) != 0 )
     {
         return false;
     }

     sqlite3 * handler = *static_cast<sqlite3**>( v.data() );
     if ( !handler )
         return false;

     ...
}

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

--
Tel.: +49 (0)711 22 88-10  *  Fax: +49 (0)711 22 88-111
Web: http://www.trimble.com/geospatial/  *  http://www.inpho.de/
Trimble Germany GmbH  *  Branch office Stuttgart
Rotebühlstraße 81  *  70178 Stuttgart  *  Germany
Commercial register: HRB 83893, Darmstadt
Managing Directors: Dr. Frank Heimberg, Hans-Jürgen Gebauer

Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to