我试图在Chrome中创建书签扩展,我想利用WebSQL在本地存储有关书签的所有类型的信息。这是我到目前为止已经完成:WebSQL changeVersion总是失败
(function() {
var Home,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
Home = (function() {
function Home() {
this.onDBInit = __bind(this.onDBInit, this); this.db = openDatabase("Journal", "", "Bookmarks Stats", 5 * 1024 * 1024, this.onDBInit, this.onDBError);
}
Home.prototype.onDBInit = function(db) {
console.log(db.version);
db.changeVersion("", "1.0", this.initDB, this.onDBError);
return console.log(db);
};
Home.prototype.initDB = function(t) {
console.log(t);
return t.executeSql('CREATE TABLE bookmarks (id, title, url)');
};
Home.prototype.onDBError = function(e) {
return console.log(e);
};
return Home;
})();
window.Registerable(Home);
}).call(this);
出于某种原因,changeVersion 总是失败。我试图删除数据库,重新启动Chrome等。Chrome版本:18.
你有没有解决这个问题? – 2012-06-13 08:49:21
我想我做了..这太长了。我认为第一个参数需要类似“1.0”...无论如何,webSQL已被弃用,你可能想尝试其他替代方法,如indexedDB维护:http://www.w3.org/TR/IndexedDB/ – 2012-06-16 23:47:24