readonly support for mysql

This commit is contained in:
Jan Prochazka
2022-03-17 11:26:38 +01:00
parent 4efcef192a
commit 34658e134f
5 changed files with 23 additions and 3 deletions

View File

@@ -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);