Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
4.8.0, 5.2.1, 5.9.6, 5.15.2
-
None
-
MacOS 10.6.8, 10.9.2, 10.13, 10.14
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
- duplicates
-
QTBUG-25260 MacOS ODBC issue
- Closed