diff options
Diffstat (limited to 'tests/auto/declarative/sql')
-rw-r--r-- | tests/auto/declarative/sql/data/test1.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/declarative/sql/data/test1.js b/tests/auto/declarative/sql/data/test1.js index ea3b7b0..95fa99e 100644 --- a/tests/auto/declarative/sql/data/test1.js +++ b/tests/auto/declarative/sql/data/test1.js @@ -1,14 +1,17 @@ var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000); -var r="testerror"; +var r="transaction_not_finished"; // Asynchronous in WebKit, so must wait before calling test() -db.transaction(function(tx) { - r = "passed"; - tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', [], - function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message }); - tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ], - function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message }); -}, function(tx, error) { r="TXFAILED: "+error.message }, function(tx, result) { if (r=="testerror") r="passed" }); +db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', [], + function(tx, rs) { }, function(tx, error) { r="CREATE FAILED: "+error.message }); + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ], + function(tx, rs) { }, function(tx, error) { r="INSERT FAILED: "+error.message }); + }, + function(tx, error) { r="TRANSACTION FAILED: "+error.message }, + function(tx, result) { if (r=="transaction_not_finished") r="passed" } +); function test() |