[SOLVED] Add own method into QOCIDriver



  • Hi all
    I am not familiar with C++ and Qt yet
    I try to add my own function into QOCIDriver
    I add function into qsql_oci.h & qsql_oci.cpp compile dll but
    include qsql_oci.h into my project but still can't use my method
    can anybody say what I forget?
    thank you



  • may be the header that you are using is old one. Or You forgot to export the symbol using Q_DECL_EXPORT. Unlike linux, windows shared library need the symbol to be explicitly exported.



  • thanks for answer
    I do not change header just add my own method

    @class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver
    {
    Q_OBJECT
    friend struct QOCIResultPrivate;
    friend class QOCIPrivate;
    public:
    explicit QOCIDriver(QObject* parent = 0);
    QOCIDriver(OCIEnv* env, OCISvcCtx* ctx, QObject* parent = 0);
    ~QOCIDriver();
    bool hasFeature(DriverFeature f) const;
    bool open(const QString & db,
    const QString & user,
    const QString & password,
    const QString & host,
    int port,
    const QString& connOpts);
    void close();
    QSqlResult *createResult() const;
    QStringList tables(QSql::TableType) const;
    QSqlRecord record(const QString& tablename) const;
    QSqlIndex primaryIndex(const QString& tablename) const;
    QString formatValue(const QSqlField &field,
    bool trimStrings) const;
    QVariant handle() const;
    QString escapeIdentifier(const QString &identifier, IdentifierType) const;
    void * getEnv(); // my function invisible in application that use dll
    protected:
    bool beginTransaction();
    bool commitTransaction();
    bool rollbackTransaction();

    private:
    QOCIDriverPrivate *d;
    };@



  • I add method into
    e:\Qt\Qt5.0.0\5.0.0\Src\qtbase\src\sql\drivers\oci\qsql_oci.h
    e:\Qt\Qt5.0.0\5.0.0\Src\qtbase\src\sql\drivers\oci\qsql_oci.cpp
    compile and receive fresh dll
    after that I add same method into
    e:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtSql\qsql_oci.h
    and try to use it in my application

    but receive LNK2019
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QOCIDriver::breakCurrentSql(void)" (_imp?breakCurrentSql@QOCIDriver@@QAE_NXZ) referenced in function "public: static bool __cdecl PlSqlTools::breakCurrentSql(class QSqlDatabase &,class QString &)" (?breakCurrentSql@PlSqlTools@@SA_NAAVQSqlDatabase@@AAVQString@@@Z)
    1>debug\test1.exe : fatal error LNK1120: 1 unresolved externals

    can any one help me with this issue
    thank you



  • ok I go to another way just implement in QOCIDriver slot
    bool cancelQuery(); described in QSqlDriver and all run ))


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.