tests/auto/declarative/qdeclarativesqldatabase/data/readonly-error.js
changeset 30 5dc02b23752f
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
       
     1 function test() {
       
     2     var r="transaction_not_finished";
       
     3     var db = openDatabaseSync("QmlTestDB-readonly-error", "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         }
       
    10     );
       
    11 
       
    12     try {
       
    13         db.readTransaction(
       
    14             function(tx) {
       
    15                 tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
       
    16                 r = "FAILED";
       
    17             }
       
    18         );
       
    19     } catch (err) {
       
    20         if (err.message == "Read-only Transaction")
       
    21             r = "passed";
       
    22         else
       
    23             r = "WRONG ERROR="+err.message;
       
    24     }
       
    25 
       
    26     return r;
       
    27 }