Skip to content

Commit

Permalink
more cleanup from gfxmonk --thx tim!
Browse files Browse the repository at this point in the history
  • Loading branch information
brianleroux committed Mar 11, 2010
2 parents 8b4870a + ddd814f commit 6dc8deb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/adaptors/DOMStorageAdaptor.js
Expand Up @@ -69,10 +69,10 @@ DOMStorageAdaptor.prototype = {
var results = [];
for (var i = 0, l = this.storage.length; i < l; ++i) {
var id = this.storage.key(i);
var obj = this.deserialize(this.storage.getItem(id));
var tbl = id.split('::')[0];
var key = id.split('::')[1];
var tbl = id.split('::')[0]
var key = id.split('::').slice(1).join("::");
if (tbl == this.table) {
var obj = this.deserialize(this.storage.getItem(id));
obj.key = key;
results.push(obj);
}
Expand Down
12 changes: 9 additions & 3 deletions src/adaptors/WebkitSQLiteAdaptor.js
Expand Up @@ -27,8 +27,12 @@ WebkitSQLiteAdaptor.prototype = {
this.db = merge(null, opts.db );

// default sqlite callbacks
this.onError = function(){}; // merge(function(t,e){console.log(e.message)}, options.onError);
this.onData = function(){}; // merge(function(r){console.log(r)}, options.onData);
this.onError = function(){};
this.onData = function(){};

if("onError" in opts) {
this.onError = opts.onError;
}

// error out on shit browsers
if (!window.openDatabase)
Expand All @@ -40,7 +44,9 @@ WebkitSQLiteAdaptor.prototype = {
// create a default database and table if one does not exist
this.db.transaction(function(tx) {
tx.executeSql("SELECT COUNT(*) FROM " + that.table, [], function(){}, function(tx, error) {
tx.executeSql("CREATE TABLE "+ that.table + " (id NVARCHAR(32) UNIQUE PRIMARY KEY, value TEXT, timestamp REAL)", [], function(){}, that.onError);
that.db.transaction(function(tx) {
tx.executeSql("CREATE TABLE "+ that.table + " (id NVARCHAR(32) UNIQUE PRIMARY KEY, value TEXT, timestamp REAL)", [], function(){}, that.onError);
});
});
});
},
Expand Down

0 comments on commit 6dc8deb

Please sign in to comment.