Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Add own method into QOCIDriver

[SOLVED] Add own method into QOCIDriver

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Galbarad
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pritamghanghas
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galbarad
        wrote on last edited by
        #3

        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;
        };@

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Galbarad
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Galbarad
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved