diff options
author | Bill King <bill.king@nokia.com> | 2010-04-20 02:07:22 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2010-04-20 02:07:22 (GMT) |
commit | dd478a4b829921c9dfeb23110177a30f32eca5af (patch) | |
tree | 4acb0bd7f0eaa61c2380580ff4835f74f0913ec7 /tests/auto/qsqlquery | |
parent | 84f0ae22f4b1e7882f4c0fff2a1f5bc47ebceb37 (diff) | |
download | Qt-dd478a4b829921c9dfeb23110177a30f32eca5af.zip Qt-dd478a4b829921c9dfeb23110177a30f32eca5af.tar.gz Qt-dd478a4b829921c9dfeb23110177a30f32eca5af.tar.bz2 |
Fix sqlite driver doesn't return error message RAISE by a trigger.
Task-number: QTBUG-7988
Reviewed-by: Justin McPherson
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index db3a929..c7a61a5 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -209,6 +209,8 @@ private slots: void QTBUG_6852(); void QTBUG_5765_data() { generic_data("QMYSQL"); } void QTBUG_5765(); + void sqlite_constraint_data() { generic_data("QSQLITE"); } + void sqlite_constraint(); #if 0 void benchmark_data() { generic_data(); } @@ -3078,6 +3080,31 @@ void tst_QSqlQuery::QTBUG_5765() QCOMPARE(q.value(0).toInt(), 123); } +void tst_QSqlQuery::sqlite_constraint() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + + if (db.driverName() != QLatin1String("QSQLITE")) { + QSKIP("Sqlite3 specific test", SkipSingle); + return; + } + + QSqlQuery q(db); + const QString trigger(qTableName("test_constraint", __FILE__)); + + QVERIFY_SQL(q, exec("CREATE TEMP TRIGGER "+trigger+" BEFORE DELETE ON "+qtest+ + "\nFOR EACH ROW " + "\nBEGIN" + "\n SELECT RAISE(ABORT, 'Raised Abort successfully');" + "\nEND;" + )); + + QVERIFY(!q.exec("DELETE FROM "+qtest)); + QCOMPARE(q.lastError().databaseText(), QLatin1String("Raised Abort successfully")); +} + #if 0 void tst_QSqlQuery::benchmark() { |