Add mbcheck.
This commit is contained in:
@@ -34,6 +34,17 @@ MBTiles.prototype.exists = function(table, callback) {
|
||||
}
|
||||
};
|
||||
|
||||
// DB integrity check.
|
||||
MBTiles.prototype.integrity = function(callback) {
|
||||
this.db.get('PRAGMA quick_check(1)', function(err, row) {
|
||||
if (!(row && row.integrity_check && row.integrity_check === 'ok')) {
|
||||
callback(new Error('Corrupted database.'));
|
||||
} else {
|
||||
callback(null, true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Setup schema, indices, views for a new mbtiles database.
|
||||
// Sets the synchronous flag to OFF for (much) faster inserts.
|
||||
// See http://www.sqlite3.org/pragma.html#pragma_synchronous
|
||||
|
||||
Reference in New Issue
Block a user