summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/sql/data/readonly-error.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/sql/data/readonly-error.js')
-rw-r--r--tests/auto/declarative/sql/data/readonly-error.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/sql/data/readonly-error.js b/tests/auto/declarative/sql/data/readonly-error.js
new file mode 100644
index 0000000..69ec67f
--- /dev/null
+++ b/tests/auto/declarative/sql/data/readonly-error.js
@@ -0,0 +1,27 @@
+function test() {
+ var r="transaction_not_finished";
+ var db = openDatabaseSync("QmlTestDB-readonly-error", "1.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ }
+ );
+
+ try {
+ db.readTransaction(
+ function(tx) {
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ r = "FAILED";
+ }
+ );
+ } catch (err) {
+ if (err.message == "Read-only Transaction")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}