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

MacOS ODBC issue

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.0, 5.2.1, 5.9.6
    • SQL Support
    • None
    • MacOS 10.6.8, 10.9.2
    • macOS

    Description

      ODBC is not working correctly in MacOS.

       
      QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
      QString dsn = QString("DRIVER={FileMaker ODBC};SERVER=%1;DATABASE=%2;UID=%3;PWD=%4;").arg(serverName).arg(dbName).arg(user).arg(pass);
      db.setDatabaseName(dsn);
      if(!db.open())
      {
        cout << qPrintable(db.lastError().text()) << endl;
        return -1;
      }
      QSqlQuery q(db);
      if(!q.exec("SELECT * FROM test"))
      {
        cout << qPrintable(q.lastError().text()) << endl;
        return -1;
      }
      while(q.next())
      {
        qDebug() << q.value(0).toString();
      }
      

      Connecting to db and the query don't report any errors, but there are no values printed.
      I have found that, the problem is in qsql_odbc.cpp - QODBCResult::fetchNext() function, line 1043:

       if (d->hasSQLFetchScroll)
              r = SQLFetchScroll(d->hStmt,
                                 SQL_FETCH_NEXT,
                                 0);
          else
              r = SQLFetch(d->hStmt);
      

      d->hasSQLFetchScroll returns true, but SQLFetchScroll returns -1.
      Temporary walkaround for me is using SQLFetch(d->hStmt) instead of SQLFetchScroll.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              rivierakid Martin Dusek
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes