summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqlquery
diff options
context:
space:
mode:
authorBill King <bking@trolltech.com>2009-09-17 03:15:40 (GMT)
committerBill King <bking@trolltech.com>2009-09-17 03:15:40 (GMT)
commit18c0fec3afba909faa341c766f31d679892021db (patch)
tree8562e5947e0a5d1cd2b81618ad277344a98b9391 /tests/auto/qsqlquery
parent59dbb1b7e737713fc650c25a20967ec26cc3ff3d (diff)
downloadQt-18c0fec3afba909faa341c766f31d679892021db.zip
Qt-18c0fec3afba909faa341c766f31d679892021db.tar.gz
Qt-18c0fec3afba909faa341c766f31d679892021db.tar.bz2
Fixes issue of forward only datasets failing when not set so.
Previously you had to set forward only on non-scrollable datasets explicitly. This queries ODBC, to determine if it's a scrollable dataset, and sets forwardOnly to false if it isn't. Task-number: QT-353 Reviewed-by: Justin McPherson
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 1595f33..3463153 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -191,6 +191,9 @@ private slots:
void task_233829_data() { generic_data("QPSQL"); }
void task_233829();
+ void sqlServerReturn0_data() { generic_data(); }
+ void sqlServerReturn0();
+
private:
// returns all database connections
@@ -310,6 +313,13 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
tablenames << qTableName( "task_250026" );
+ if (tst_Databases::isSqlServer( db )) {
+ QSqlQuery q( db );
+ q.exec("DROP PROCEDURE " + qTableName("test141895_proc"));
+ }
+
+ tablenames << qTableName("test141895");
+
tst_Databases::safeDropTables( db, tablenames );
}
@@ -2842,5 +2852,33 @@ void tst_QSqlQuery::task_233829()
QVERIFY_SQL(q,exec());
}
+void tst_QSqlQuery::sqlServerReturn0()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (!tst_Databases::isSqlServer( db ))
+ QSKIP("SQL Server specific test", SkipSingle);
+
+ QString tableName(qTableName("test141895")), procName(qTableName("test141895_proc"));
+ QSqlQuery q( db );
+ q.exec("DROP TABLE " + tableName);
+ q.exec("DROP PROCEDURE " + procName);
+ QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+" (id integer)"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (1)"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (2)"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (2)"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (3)"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (1)"));
+ QVERIFY_SQL(q, exec("CREATE PROCEDURE "+procName+
+ " AS "
+ "SELECT * FROM "+tableName+" WHERE ID = 2 "
+ "RETURN 0"));
+
+ QVERIFY_SQL(q, exec("{CALL "+procName+"}"));
+
+ QVERIFY_SQL(q, next());
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"