Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativesqldatabase / data / readonly.js
1 function test() {
2     var r="transaction_not_finished";
3     var db = openDatabaseSync("QmlTestDB-readonly", "1.0", "Test database from Qt autotests", 1000000);
4
5     db.transaction(
6         function(tx) {
7             tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
8             tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
9             r = "passed";
10         }
11     );
12
13     db.readTransaction(
14         function(tx) {
15             var rs = tx.executeSql('SELECT * FROM Greeting');
16             if (rs.rows.item(0).salutation == 'hello')
17                 r = "passed";
18             else
19                 r = "FAILED";
20         }
21     );
22
23     return r;
24 }