[Interest] Sqlite3 handler access

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Aug 14 16:16:01 CEST 2012


Yep, the pointer "looks" fine in the debugger...  

Though I did find an article, that it sounds like using it in Qt with SQLITE3 setup to support multithreading could be the issue...

So it may take a recompile of QtSql :(

Scott

-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of Rainer Wiesenfarth
Sent: Tuesday, August 14, 2012 5:21 AM
To: interest at qt-project.org
Subject: Re: [Interest] Sqlite3 handler access

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



More information about the Interest mailing list