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. Patch Oracle OCI Driver to support REF CURSOR submitted
Forum Updated to NodeBB v4.3 + New Features

Patch Oracle OCI Driver to support REF CURSOR submitted

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.7k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    TioRoy
    wrote on last edited by SGaist
    #1

    I wrote a patch ("submitted to jira":https://bugreports.qt.io/browse/QTBUG-166) to Oracle OCI driver to support REF CURSOR.

    The example code:

    #include <QtCore/QCoreApplication>
    #include <QtSql/QSqlDatabase>
    #include <QtSql/QOCIDriver>
    #include <QtSql/QSqlQuery>
    #include <QtCore>
    
    Q_DECLARE_METATYPE(QOCIResult *) //Required to bind QOCIResult (QVariant)
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
    
        QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
        db.setHostName("192.168.0.1");
        db.setUserName("user");
        db.setPassword("pass");
        db.setDatabaseName("ORACLE");
        db.open();
    
        QOCIResult *cursor = (QOCIResult *) db.driver()->createResult();
    
        QSqlQuery query;
        query.prepare("call tst.Search(:c, :busca, :tipo, :bolsa)");
        query.addBindValue(qVariantFromValue(cursor), QSql::Out);
        query.addBindValue("DI", QSql::In);
        query.addBindValue("F", QSql::In);
        query.addBindValue("T", QSql::In);
    
        if (query.exec&#40;&#41;) {
            if (cursor->exec&#40;&#41;) { //To load column information
                QSqlQuery queryCursor(cursor);
    
                while (queryCursor.next()) {
                    qDebug() << "Value[0]=" << queryCursor.value(0).toString();
                }
    
            }
        }
    }
    

    [edit: Update patch link and code tags SGaist]

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hsn_salhi
      wrote on last edited by
      #2

      Hello,
      can you please help solving some problems while using your patch ? Here is what i've done.

      • I downloaded the patch files (diff_qsql_oci.cpp.patch & diff_qsql_oci.h.patch) and applied the modifications.
      • I rebluit the oci driver by using the modifications.
      • I put the new qsql_oci cpp and h files everywhere.
      • When compiling, I have the folowing compile errors :
        @qt_metatype_id' is not a member of 'QMetaTypeId<QOCIResult*>@

      So I don't know what I missed !
      Plz I need this patch to work can you help me ?
      thank you.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hsn_salhi
        wrote on last edited by
        #3

        sory about that !!!!
        I know now what I missed !
        simply the first ligne in your code hihi
        @Q_DECLARE_METATYPE(QOCIResult *) //Required to bind QOCIResult (QVariant)@
        thank you for the post and the patch.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cki61
          wrote on last edited by
          #4

          Hello TioRoy,

          I'm just trying to port this patch to Qt 5.4. As a newbee to Qt not just the easiest beginning, but I need access to Oracle Ref Corsors.
          I have to admit that I don't know exactly the structure of the changed classes.
          Thats I guess the reason why I can't pass the error

          • 'QOCIResult' was not declared in this scope
            of your example above.
            Question:
          • does there already exists a patch for Qt5.4?
          • I need someone knowing the corsor theme who can take a look to my/your ported patch. Would you do this?

          I'd like to give people acces to my created patch files, but can't find a possibility to upload. Do you know how to do it?

          Sincerely,
          CKI61

                          ^
          
          1 Reply Last reply
          0
          • C Offline
            C Offline
            cki61
            wrote on last edited by
            #5

            Hello TioRoy,

            I'm just trying to port this patch to Qt 5.4. As a newbee to Qt not just the easiest beginning, but I need access to Oracle Ref Corsors.
            I have to admit that I don't know exactly the structure of the changed classes.
            Thats I guess the reason why I can't pass the error

            • 'QOCIResult' was not declared in this scope
              of your example above.
              Question:
            • does there already exists a patch for Qt5.4?
            • I need someone knowing the corsor theme who can take a look to my/your ported patch. Would you do this?

            I'd like to give people acces to my created patch files, but can't find a possibility to upload. Do you know how to do it?

            Sincerely,
            CKI61

                            ^
            
            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