diff options
Diffstat (limited to 'tests/auto/declarative/sql/data/6-iteration-efficient.js')
-rw-r--r-- | tests/auto/declarative/sql/data/6-iteration-efficient.js | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/tests/auto/declarative/sql/data/6-iteration-efficient.js b/tests/auto/declarative/sql/data/6-iteration-efficient.js index 6711fb0..fe0acfc 100644 --- a/tests/auto/declarative/sql/data/6-iteration-efficient.js +++ b/tests/auto/declarative/sql/data/6-iteration-efficient.js @@ -1,32 +1,29 @@ -var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000); -var r=0; -var fbefore="FORWARD WRONG" -var fafter="FORWARD WRONG" +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="" - if (!rs.rows.forwardOnly) fbefore="" - rs.rows.forwardOnly = true; - if (rs.rows.forwardOnly) fafter=""; + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + var r1="" + var fbefiore = rs.rows.forwardOnly; + rs.rows.forwardOnly = true; + var fafter = rs.rows.forwardOnly; + if (fbefore) + r = "forward wrong before"; + else if (!fafter) + r = "forward wrong after"; + else { for(var i=0; rs.rows[i]; ++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=fbefore+"passed"+fafter } -); + else + r = "passed"; + } + } + ); - -function test() -{ - if (r == 0) r = "transaction_not_finished"; return r; } |