summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqlquery/tst_qsqlquery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qsqlquery/tst_qsqlquery.cpp')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp27
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()
{