diff options
Diffstat (limited to 'tests/auto/declarative/sql/data/4-iteration-index.js')
-rw-r--r-- | tests/auto/declarative/sql/data/4-iteration-index.js | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/tests/auto/declarative/sql/data/4-iteration-index.js b/tests/auto/declarative/sql/data/4-iteration-index.js index 298737d..512cf8d 100644 --- a/tests/auto/declarative/sql/data/4-iteration-index.js +++ b/tests/auto/declarative/sql/data/4-iteration-index.js @@ -1,27 +1,19 @@ -var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000); -var r=0; +function test() { + var db = openDatabaseSync("QmlTestDB", "", "Test database from Qt autotests", 1000000); + var r="transaction_not_finished"; -db.transaction( - function(tx) { - tx.executeSql('SELECT * FROM Greeting', [], - function(tx, rs) { - var r1="" - for(var i = 0; i < rs.rows.length; i++) { - r1 += rs.rows[i].salutation + ", " + rs.rows[i].salutee + ";" - } - if (r1 != "hello, world;hello, world;hello, world;hello, world;") - r = "SELECTED DATA WRONG: "+r1; - }, - function(tx, error) { if (r==0) r="SELECT FAILED: "+error.message } - ); - }, - function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message }, - function(tx, result) { if (r==0) r="passed" } -); + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + var r1="" + for(var i = 0; i < rs.rows.length; i++) + r1 += rs.rows[i].salutation + ", " + rs.rows[i].salutee + ";" + if (r1 != "hello, world;hello, world;hello, world;hello, world;") + r = "SELECTED DATA WRONG: "+r1; + else + r = "passed"; + } + ); - -function test() -{ - if (r == 0) r = "transaction_not_finished"; return r; } |