Add optional 'db' parameter to Zotero.DB.tableExists()
To check attached databases
This commit is contained in:
parent
52737ec694
commit
86b94ae713
1 changed files with 3 additions and 2 deletions
|
@ -818,9 +818,10 @@ Zotero.DBConnection.prototype.logQuery = function (sql, params = [], options) {
|
|||
}
|
||||
|
||||
|
||||
Zotero.DBConnection.prototype.tableExists = Zotero.Promise.coroutine(function* (table) {
|
||||
Zotero.DBConnection.prototype.tableExists = Zotero.Promise.coroutine(function* (table, db) {
|
||||
yield this._getConnectionAsync();
|
||||
var sql = "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND tbl_name=?";
|
||||
var prefix = db ? db + '.' : '';
|
||||
var sql = `SELECT COUNT(*) FROM ${prefix}sqlite_master WHERE type='table' AND tbl_name=?`;
|
||||
var count = yield this.valueQueryAsync(sql, [table]);
|
||||
return !!count;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue