I have tried
"select load_extension('mylib.so')" through QSQLQUERY.
But it fails, with following error.
unknown function name LOAD_EXTENSION
and for the API from QT
i hav included sqlite3ext.h
and following code
QSqlQuery qmenu;
QVariant v = qMenu.driver()->handle();
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0)
{
sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
if (handle != 0)
{
sqlite3_enable_load_extension(handle,1);
const char *zProc="0",*zErr="0";
int b = sqlite3_load_extension(handle,zFilename,0,0);
qDebug()<<b;
//qDebug()<<"select
load_extension('/home/bala/Ramana/R_D/sqliteAlternate/Triggers/UDF/lib/ext/libasc.so')";
qMenu=db.SelectQuery("select ceil(1.5)");
db.clearAll();
if(db.IsLastError())
{
qMenu.clear();
return;
}
qMenu.next();
qDebug()<<qMenu.value(0).toString();
qMenu.clear();
}
}
i dont know ,what are the 3rd and 4th parameters in
sqlite3_load_extension.just i put 0 and 0.
The program stop responding @ int b =
sqlite3_load_extension(handle,zFilename,0,0);
Thnks
Bala
Kees Nuyt wrote:
>
> On Sat, 23 Jan 2010 22:57:24 -0800 (PST), greensparker
> <[email protected]> wrote:
>
>>
>>hi, im using DEBIAN,QT4.5.2
>> I have custom functions in sqlite,like ascii,ceil,floor etc.
>>lib name is myfunciton.so.
>>i have tested manually in sqlite3 command line by using, select
>>load_extension('myfunction.so') .
>>Its working well. my question is ,how can i automate this with QT.
>>i want to use CEIL function from QT.
>>like,
>>QSqlquery q=("select ceil(5.2)");
>>
>>pls guide me
>>
>>Bala
>
> load_extension() is a SQL function, so you could try to do
> the same from QT.
>
> : QSqlquery q=("select load_extension('/path/to/myfunctions.so')");
> : QSqlquery q=("select ceil(5.2)");
>
> If that doesn't work, try to find the equivalent for
> sqlite3_load_extension() in the QSql API.
>
> http://www.sqlite.org/lang_corefunc.html#load_extension
> --
> ( Kees Nuyt
> )
> c[_]
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
--
View this message in context:
http://old.nabble.com/how-to-load-custom-function-from-QT-tp27292725p27293446.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users