summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIsrael Lins Albuquerque <israel@proabakus.com.br>2014-03-26 12:45:41 -0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-29 08:46:00 +0100
commit075c876f9afd434ccf86664bf978287915468580 (patch)
treebf5c32e7502a777fd18d989dcd1a374ccbc8f36c /tests
parentd4320916227a16590e4ba7eb71004eda4301e26f (diff)
[QtSql]QIBASE]add support for prepared queries in numRowsAffected
Prepared queries need to be handled as procedures. Change-Id: I4b4d7743fe45c416ca83ceb942aa48d79731f2f8 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 5f1eb99524..a497fac79a 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -1069,6 +1069,18 @@ void tst_QSqlQuery::numRowsAffected()
QCOMPARE( q.numRowsAffected(), i );
QCOMPARE( q.numRowsAffected(), i ); // yes, we check twice
+ QVERIFY_SQL( q, prepare( "update " + qtest + " set id = id + :newid" ) );
+ q.bindValue(":newid", 100);
+ QVERIFY_SQL( q, exec() );
+ QCOMPARE( q.numRowsAffected(), i );
+ QCOMPARE( q.numRowsAffected(), i ); // yes, we check twice
+
+ QVERIFY_SQL( q, prepare( "update " + qtest + " set id = id + :newid where NOT(1 = 1)" ) );
+ q.bindValue(":newid", 100);
+ QVERIFY_SQL( q, exec() );
+ QCOMPARE( q.numRowsAffected(), 0 );
+ QCOMPARE( q.numRowsAffected(), 0 ); // yes, we check twice
+
QVERIFY_SQL( q, exec( "insert into " + qtest + " values (42000, 'homer', 'marge')" ) );
QCOMPARE( q.numRowsAffected(), 1 );
QCOMPARE( q.numRowsAffected(), 1 ); // yes, we check twice