summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-04-12 12:49:03 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-13 21:26:07 +0200
commitcf52540dfbf320e3d5cb9f7546542233c170af80 (patch)
tree557c2ba7a4920c1b36ef6a9340bd48b38e354d10 /tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
parent13ebff81d034579c3686aa1e1f6aa1f8a0dfcb93 (diff)
QTBUG-1363: fix QSqlField.length() for ODBC
Applied Bill King's suggestion in QTBUG-1363. Columns of hStmt must be accessed in order. Verified using ODBC driver on SQL Server 2005 on Windows 7. Added test for length of text field for MS SQL Server over ODBC. Task-Id: QTBUG-1363 Change-Id: I6673dafe75e3ef394d41e439adb45096c1421068 Reviewed-by: Bill King <bill.king@nokia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp')
-rw-r--r--tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
index 68a347ebdb..7d34981a73 100644
--- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
@@ -129,6 +129,10 @@ void tst_QSqlDriver::record()
QSqlRecord rec = db.driver()->record(tablename);
QCOMPARE(rec.count(), 4);
+ // QTBUG-1363: QSqlField::length() always return -1 when using QODBC3 driver and QSqlDatabase::record()
+ if (db.driverName().startsWith("QODBC") && tst_Databases::isSqlServer(db))
+ QCOMPARE(rec.field(1).length(), 20);
+
if (db.driverName().startsWith("QIBASE")|| db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"))
for(int i = 0; i < fields.count(); ++i)
fields[i] = fields[i].toUpper();