summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js')
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js b/tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js
new file mode 100644
index 0000000..a7af3bd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesqldatabase/data/error-outsidetransaction.js
@@ -0,0 +1,17 @@
+function test() {
+ var db = openDatabaseSync("QmlTestDB-data/error-notransaction", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+ var v;
+
+ try {
+ db.transaction(function(tx) { v = tx });
+ v.executeSql("SELECT 'bad'")
+ } catch (err) {
+ if (err.message == "executeSql called outside transaction()")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}