OLD | NEW |
| (Empty) |
1 function executeStatement(tx, expectedToPass, statement) | |
2 { | |
3 var message; | |
4 try { | |
5 tx.executeSql(statement); | |
6 message = expectedToPass ? "PASS: " : "FAIL: "; | |
7 } catch (err) { | |
8 message = !expectedToPass ? "PASS: " : "FAIL: "; | |
9 } | |
10 postMessage(message + statement + ", " + db.lastErrorMessage); | |
11 } | |
12 | |
13 var db = openDatabaseSync("ExecuteSQLAcceptsOnlyOneStatementTest", "1.0", "", 1)
; | |
14 db.transaction(function(tx) { | |
15 tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)"); | |
16 executeStatement(tx, true, "INSERT INTO Test VALUES (1)"); | |
17 executeStatement(tx, true, "INSERT INTO Test VALUES (2);"); | |
18 executeStatement(tx, true, " INSERT INTO Test VALUES (3) "); | |
19 executeStatement(tx, true, " INSERT INTO Test VALUES (4); "); | |
20 executeStatement(tx, true, "INSERT INTO Test VALUES (5) ;"); | |
21 executeStatement(tx, false, "INSERT INTO Test VALUES (6); garbage"); | |
22 executeStatement(tx, false, "INSERT INTO Test VALUES (7); INSERT INTO Test V
ALUES (8)"); | |
23 executeStatement(tx, false, " INSERT INTO Test VALUES (9); INSERT INTO Te
st VALUES (10); "); | |
24 }); | |
25 postMessage("done"); | |
OLD | NEW |