summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js')
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js b/tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js
new file mode 100644
index 0000000..5ee862c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesqldatabase/data/readonly.js
@@ -0,0 +1,24 @@
+function test() {
+ var r="transaction_not_finished";
+ var db = openDatabaseSync("QmlTestDB-readonly", "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' ]);
+ r = "passed";
+ }
+ );
+
+ db.readTransaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ if (rs.rows.item(0).salutation == 'hello')
+ r = "passed";
+ else
+ r = "FAILED";
+ }
+ );
+
+ return r;
+}