6 pre { padding:
5px; border:
1px solid black; }
13 if (window
.openDatabase
) {
14 db
= openDatabase("StressTest1", "1.0", "Database Stress Test", 200000);
16 alert("Failed to open the database on disk. This is probably because the version was bad or there is not enough space left in this domain's quota");
18 alert("Couldn't open the database.");
22 var allData
= new Array();
28 db
.transaction(function (tx
)
30 tx
.executeSql("INSERT INTO FillerData (id, filler) VALUES (?, randomblob(1024))", [id
]);
36 for (var i
= 0; i
< 4; i
++) {
40 setTimeout("testClose();", 0);
45 db
.transaction(function(tx
)
47 for (var i
= 0; i
< allData
.length
; i
++)
48 tx
.executeSql("DELETE FROM FillerData WHERE id = ?", [allData
[i
]]);
50 allData
= new Array();
52 setTimeout("testOpen();", 0);
55 function updateTransactionCount()
57 document
.getElementById("transactionCount").innerHTML
= "Current Transaction Count: " + highestId
;
58 setTimeout("updateTransactionCount();", 1000);
63 db
.transaction(function(tx
) {
64 tx
.executeSql("SELECT COUNT(*) FROM FillerData", [], function(result
) { }, function(tx
, error
) {
65 tx
.executeSql("CREATE TABLE FillerData (id REAL UNIQUE, filler)", [], function(result
) {
70 setTimeout("testOpen();", 0);
71 setTimeout("updateTransactionCount();", 1000);
74 addEventListener('load', loaded
, false);
79 This test stresses the database threading code by constantly opening transactions to the test database at a fast rate.
<br>
80 See radar
5729446 for more details.
<br>
81 <pre id=
"transactionCount">Current Transaction Count:
0</pre>