Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28205

OCI: When binding a QByteArray to a CLOB field it does not get written correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.3, 5.0.0 Beta 2
    • SQL Support
    • None

    Description

      OCI: When binding a QByteArray to a CLOB field it does not get written correctly.

      #include <QtCore>
      #include <QtSql>
      
      int main(int argc, char **argv)
      {
          QCoreApplication a(argc, argv);
          QVariant var;
          {
              QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
              db.setDatabaseName(":memory:");
              db.open();
              QSqlQuery q;
              q.exec("CREATE TABLE TEST(id int, myText text)");
              q.exec("INSERT INTO TEST(1, 'ABCD')");
              q.exec("SELECT * from TEST");
              q.next();
              var = q.value(1);
          }
          {
              QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
              db.setDatabaseName("ocidb");
              db.setUserName("ociuser");
              db.setPassword("ocipass");
              db.open();
              QSqlQuery q;
              q.exec("CREATE TABLE TEST(id number(10), myText clob)");
              q.prepare("INSERT INTO TEST(1, :txt)");
              q.bindValue(":txt", var);
              q.exec();
              QSqlQuery selectQ;
              selectQ.exec("SELECT * from TEST");
              q.next();
              qDebug() << q.value(1);
          }
          return 0;
      }
      

      Instead of getting ABCD written it is a bunch of numbers instead.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            andysh Andy Shaw
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes