[Interest] Sqlite3 handler access
Rainer Wiesenfarth
Rainer_Wiesenfarth at trimble.com
Tue Aug 14 14:20:37 CEST 2012
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.Bloom at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4502 bytes
Desc: S/MIME Kryptografische Unterschrift
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120814/1e157c7b/attachment.bin>
More information about the Interest
mailing list