window.WebSQL = { _open : function() { return window.openDatabase('geos', '', 'myDB', 50000000); }, reinstall : function(vers) { var db = this._open(); db.changeVersion(db.version, vers, function(t) { t.executeSql('CREATE TABLE pos (id, lat float, lon float)'); }); }, read : function (key, cbk) { this._open().readTransaction(function(t) { t.executeSql('SELECT * FROM pos WHERE id = ?', [key], function(t, d) {d.rows.length?cbk(d.rows.item(0)):''}, function(t, e) {console.log(e.message)}); }); }, save : function(obj) { this._open().transaction(function(t,r) { t.executeSql('INSERT INTO pos (id, lon, lat) VALUES (?, ?, ?)', [obj.key, obj.lon, obj.lat]) }); } };