Style cleanup.
This commit is contained in:
+9
-15
@@ -96,24 +96,18 @@ MBTiles.findID = function(filepath, id, callback) {
|
|||||||
MBTiles.prototype._exists = function(table, callback) {
|
MBTiles.prototype._exists = function(table, callback) {
|
||||||
if (typeof callback !== 'function') callback = noop;
|
if (typeof callback !== 'function') callback = noop;
|
||||||
|
|
||||||
if (this._schema) {
|
if (this._schema) return callback(null, this._schema.indexOf(table) !== -1);
|
||||||
return callback(null, this._schema.indexOf(table) !== -1);
|
|
||||||
} else {
|
var sql = 'SELECT name FROM sqlite_master WHERE type IN ("table", "view")';
|
||||||
this._db.all(
|
var mbtiles = this;
|
||||||
'SELECT name FROM sqlite_master WHERE type IN (?, ?)',
|
this._db.all(sql, function(err, rows) {
|
||||||
'table',
|
if (err) return callback(err);
|
||||||
'view',
|
mbtiles._schema = rows.map(function(r) { return r.name });
|
||||||
function(err, rows) {
|
mbtiles._exists(table, callback);
|
||||||
if (err) return callback(err);
|
});
|
||||||
this._schema = rows.map(function(r) { return r.name });
|
|
||||||
this._exists(table, callback);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// DB integrity check.
|
// DB integrity check.
|
||||||
//
|
|
||||||
// - @param {Function(err)} callback
|
// - @param {Function(err)} callback
|
||||||
MBTiles.prototype._integrity = function(callback) {
|
MBTiles.prototype._integrity = function(callback) {
|
||||||
if (typeof callback !== 'function') callback = noop;
|
if (typeof callback !== 'function') callback = noop;
|
||||||
|
|||||||
Reference in New Issue
Block a user