mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 03:16:01 +00:00
readonly support for mysql
This commit is contained in:
@@ -33,6 +33,10 @@ module.exports = {
|
||||
closed: {},
|
||||
requests: {},
|
||||
|
||||
async _init() {
|
||||
connections._closeAll = conid => this.closeAll(conid);
|
||||
},
|
||||
|
||||
handle_structure(conid, database, { structure }) {
|
||||
const existing = this.opened.find(x => x.conid == conid && x.database == database);
|
||||
if (!existing) return;
|
||||
@@ -158,7 +162,7 @@ module.exports = {
|
||||
return res.result;
|
||||
},
|
||||
|
||||
async loadDataCore(msgtype, {conid, database, ...args}) {
|
||||
async loadDataCore(msgtype, { conid, database, ...args }) {
|
||||
const opened = await this.ensureOpened(conid, database);
|
||||
const res = await this.sendRequest(opened, { msgtype, ...args });
|
||||
if (res.errorMessage) {
|
||||
@@ -274,6 +278,12 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
closeAll(conid, kill = true) {
|
||||
for (const existing of this.opened.filter(x => x.conid == conid)) {
|
||||
this.close(conid, existing.database, kill);
|
||||
}
|
||||
},
|
||||
|
||||
disconnect_meta: true,
|
||||
async disconnect({ conid, database }) {
|
||||
await this.close(conid, database, true);
|
||||
|
||||
Reference in New Issue
Block a user