mirror of
https://github.com/localForage/localForage.git
synced 2025-12-08 18:26:09 +00:00
33 lines
1.0 KiB
HTML
33 lines
1.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript">
|
|
var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
|
|
var msg;
|
|
db.transaction(function (tx) {
|
|
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGSSS (id unique, log)');
|
|
tx.executeSql('INSERT INTO LOGSSS (id, log) VALUES (1, "foobar")');
|
|
tx.executeSql('INSERT INTO LOGSSS (id, log) VALUES (2, ?)', [(new Blob([94864]))]);
|
|
msg = '<p>Log message created and row inserted.</p>';
|
|
document.querySelector('#status').innerHTML = msg;
|
|
});
|
|
|
|
db.transaction(function (tx) {
|
|
tx.executeSql('SELECT * FROM LOGSSS', [], function (tx, results) {
|
|
var len = results.rows.length, i;
|
|
msg = "<p>Found rows: " + len + "</p>";
|
|
document.querySelector('#status').innerHTML += msg;
|
|
for (i = 0; i < len; i++){
|
|
msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
|
|
document.querySelector('#status').innerHTML += msg;
|
|
console.log(msg);
|
|
}
|
|
}, null);
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="status" name="status">Status Message</div>
|
|
</body>
|
|
</html>
|