[Interest] Sqlite3 handler access

Scott Aron Bloom Scott.Bloom at onshorecs.com
Mon Aug 13 20:16:50 CEST 2012


I need to add a custom command to my sqlite3 system Im accessing via
QSqlDatabase..

 

Per reading found at sourceforge and qtcentre, I have compiled in the
code locally from the Qt source area..

 

However, on the call to sqlite3_create_function, sqlite is crashing...

 

extern "C" 

void getMsgID( sqlite3_context * context, int argc, sqlite3_value **
argv )

{

    assert( argc == 2 );

    sqlite3_result_int( context, 0 );

}

 

bool loadCustomCommands( QSqlDatabase & db )

{

    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;

 

    sqlite3_create_function( handler, "msgid", 2, SQLITE_ANY, NULL,
&getMsgID, NULL, NULL );

    return true;

}

 

Any thoughts, ideas??


Scott

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120813/c157ef6b/attachment.html>


More information about the Interest mailing list