Down to 1 test failure
This commit is contained in:
parent
c92d3a6c5f
commit
d5db4c51b9
|
@ -13,7 +13,7 @@ define(function(require) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Either do readTransaction() (read-only) or transaction() (read/write)
|
// Either do readTransaction() (read-only) or transaction() (read/write)
|
||||||
db[isReadOnly ? 'transaction' : 'readTransaction'](function(transaction) {
|
db[isReadOnly ? 'readTransaction' : 'transaction'](function(transaction) {
|
||||||
that.transaction = transaction;
|
that.transaction = transaction;
|
||||||
callback(transaction);
|
callback(transaction);
|
||||||
});
|
});
|
||||||
|
@ -33,8 +33,9 @@ define(function(require) {
|
||||||
};
|
};
|
||||||
WebSQLContext.prototype.get = function(key, callback) {
|
WebSQLContext.prototype.get = function(key, callback) {
|
||||||
function onSuccess(transaction, result) {
|
function onSuccess(transaction, result) {
|
||||||
if(result.rows.length !== 1) {
|
if(result.rows.length === 0) {
|
||||||
callback("[WebSQLContext] Error: expected 1 row for get operation.");
|
// Key not found, return null
|
||||||
|
callback(null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback(null, result.rows.item(0).data);
|
callback(null, result.rows.item(0).data);
|
||||||
|
@ -43,7 +44,7 @@ define(function(require) {
|
||||||
callback(error);
|
callback(error);
|
||||||
}
|
}
|
||||||
this.getTransaction(function(transaction) {
|
this.getTransaction(function(transaction) {
|
||||||
transaction.executeSql("SELECT * FROM " + FILE_STORE_NAME + " WHERE id = ?",
|
transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ? LIMIT 1",
|
||||||
[key], onSuccess, onError);
|
[key], onSuccess, onError);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -110,7 +111,7 @@ define(function(require) {
|
||||||
}
|
}
|
||||||
// Keep track of whether we're accessing this db for the first time
|
// Keep track of whether we're accessing this db for the first time
|
||||||
// and therefore needs to get formatted.
|
// and therefore needs to get formatted.
|
||||||
transaction.executeSql("SELECT COUNT(id) AS count FROM " + FILE_STORE_NAME,
|
transaction.executeSql("SELECT COUNT(id) AS count FROM " + FILE_STORE_NAME + ";",
|
||||||
[], gotCount, onError);
|
[], gotCount, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@ define(["IDBFS"], function(IDBFS) {
|
||||||
function wipeDB(provider) {
|
function wipeDB(provider) {
|
||||||
var context = provider.getReadWriteContext();
|
var context = provider.getReadWriteContext();
|
||||||
context.clear(function(err) {
|
context.clear(function(err) {
|
||||||
console.error("Problem clearing WebSQL db: " + err);
|
if(err) {
|
||||||
|
console.error("Problem clearing WebSQL db: [" + err.code + "] - " + err.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +37,7 @@ define(["IDBFS"], function(IDBFS) {
|
||||||
var complete = false;
|
var complete = false;
|
||||||
var _error, _result;
|
var _error, _result;
|
||||||
|
|
||||||
var provider = this.provider = this.provider = new IDBFS.FileSystem.providers.WebSQL(WEBSQL_NAME);
|
var provider = this.provider = new IDBFS.FileSystem.providers.WebSQL(WEBSQL_NAME);
|
||||||
provider.open(function(err, firstAccess) {
|
provider.open(function(err, firstAccess) {
|
||||||
_error = err;
|
_error = err;
|
||||||
_result = firstAccess;
|
_result = firstAccess;
|
||||||
|
|
Loading…
Reference in New Issue