summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqldatabase
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-10-06 01:42:36 (GMT)
committerBill King <bill.king@nokia.com>2009-10-06 01:44:02 (GMT)
commit2420c3b6c728ed4c8a8efd4c93427932420c7368 (patch)
tree1512ee14b417a89ebbb8c4ded39f130c46fc0c4c /tests/auto/qsqldatabase
parentc768694764e8bc32a7152b80653eef564631452a (diff)
downloadQt-2420c3b6c728ed4c8a8efd4c93427932420c7368.zip
Qt-2420c3b6c728ed4c8a8efd4c93427932420c7368.tar.gz
Qt-2420c3b6c728ed4c8a8efd4c93427932420c7368.tar.bz2
Add autotest for mysql savepoints.
Diffstat (limited to 'tests/auto/qsqldatabase')
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 4175bef..c9c8f5e 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -157,6 +157,8 @@ private slots:
void mysqlOdbc_unsignedIntegers();
void mysql_multiselect_data() { generic_data("QMYSQL"); }
void mysql_multiselect(); // For task 144331
+ void mysql_savepointtest_data() { generic_data("QMYSQL"); }
+ void mysql_savepointtest();
void accessOdbc_strings_data() { generic_data(); }
void accessOdbc_strings();
@@ -2433,6 +2435,19 @@ void tst_QSqlDatabase::sqlStatementUseIsNull_189093()
QCOMPARE(statment.count("IS NULL", Qt::CaseInsensitive), 2);
}
+void tst_QSqlDatabase::mysql_savepointtest()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
+ QSKIP( "Test requires MySQL >= 5.0", SkipSingle );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("begin"));
+ QVERIFY_SQL(q, exec("insert into "+qTableName("qtest")+" VALUES (54, 'foo', 'foo', 54.54)"));
+ QVERIFY_SQL(q, exec("savepoint foo"));
+}
QTEST_MAIN(tst_QSqlDatabase)
#include "tst_qsqldatabase.moc"