Style cleanup.

This commit is contained in:
Young Hahn
2013-07-12 05:29:03 -04:00
parent 906d6a444d
commit f6ff8735b2

View File

@@ -96,24 +96,18 @@ MBTiles.findID = function(filepath, id, callback) {
MBTiles.prototype._exists = function(table, callback) {
if (typeof callback !== 'function') callback = noop;
if (this._schema) {
return callback(null, this._schema.indexOf(table) !== -1);
} else {
this._db.all(
'SELECT name FROM sqlite_master WHERE type IN (?, ?)',
'table',
'view',
function(err, rows) {
if (err) return callback(err);
this._schema = rows.map(function(r) { return r.name });
this._exists(table, callback);
}.bind(this)
);
}
if (this._schema) return callback(null, this._schema.indexOf(table) !== -1);
var sql = 'SELECT name FROM sqlite_master WHERE type IN ("table", "view")';
var mbtiles = this;
this._db.all(sql, function(err, rows) {
if (err) return callback(err);
mbtiles._schema = rows.map(function(r) { return r.name });
mbtiles._exists(table, callback);
});
};
// DB integrity check.
//
// - @param {Function(err)} callback
MBTiles.prototype._integrity = function(callback) {
if (typeof callback !== 'function') callback = noop;