database.transaction(function(tx) {
tx.executeSql("SELECT data FROM data", [], function(tx, result) {
var data = result.rows.item(0).data
config = (new String(data)).evalJSON()
initWithConfig()
}, function(tx, error) {
tx.executeSql("CREATE TABLE data (data TEXT)", [],
function(tx, result) {
var data = (new Hash(config)).toJSON()
tx.executeSql("INSERT INTO data (data) VALUES (?)",
[data]);
initWithConfig()
});
});
});
And this is for storing:
database.transaction(function(tx) {
var data = (new Hash(config)).toJSON();
tx.executeSql("UPDATE data SET data=? WHERE 1", [data]);
});
Hope this helps.
Dirk
Jeff McFadden schrieb:
http://code.google.com/p/big5/source/browse/#svn/trunk
if (window.openDatabase) {
document.write("open database present");
} else
document.write("open database not available");
}