无法加载SQLite扩展

时间:2015-08-28 21:03:07

标签: c++ sqlite

#include <sqlite3ext.h>
...
QVariant v = metaDataBase.driver()->handle();
    if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) {
        sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
        if (handle != 0) {
            int res = sqlite3_enable_load_extension(handle,1);
            if (res == SQLITE_OK) {
                res = sqlite3_load_extension(handle,"libSqliteIcu.so",0,0);
                if (res == SQLITE_OK) qDebug() << "Sqlite3 loaded ICU extension sucessfully";
                else qDebug() <<  "Sqlite3 failed loading ICU extension";}
            else qDebug() << "Sqlite3 failed enabling load extension";}}

,结果是

  

'sqlite3_api'未在此范围内声明

为行

res = sqlite3_load_extension(handle,"libSqliteIcu.so",0,0);

如何让它发挥作用?

1 个答案:

答案 0 :(得分:0)

2015-08-28 18:12:19.047-Fri Aug 28 18:12:19 IST 2015DB2 Connection established -->com.ibm.db2.jcc.t4.b@c26e4a 2015-08-28 18:12:20.030-Execution failed ======> alter table BLP.COUNTER_EXTRACTION_REQUEST alter column SCHEME_ID set not null 2015-08-28 18:12:20.032-Error code for failure ======> DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=SCHEME_ID, DRIVER=3.63.123 2015-08-28 18:12:20.044-Execution failed ======> alter table BLP.COUNTER_EXTRACTION_REQUEST alter column SCHEME_TYPE set not null 2015-08-28 18:12:20.044-Error code for failure ======> DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=SCHEME_TYPE, DRIVER=3.63.123 中的评论说:

  

此头文件定义了供其使用的SQLite接口   希望作为扩展名导入的共享库   一个SQLite实例。打算加载的共享库   作为SQLite的扩展应该#include这个文件而不是   sqlite3.h。

您的应用程序不是共享库。 要使其有效,只需使用sqlite3ext.h