From 0d31cc4204cdff216b050f4029e0f67cee19e16e Mon Sep 17 00:00:00 2001 From: Juan Funez Date: Thu, 22 Apr 2021 17:06:07 +0200 Subject: [PATCH 1/2] fix typo in Readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e7c5d9ff..38f199179 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Supported databases: * Master/detail views * Query designer * Form view for comfortable work with tables with many columns -* JSON view on MognoDB collections +* JSON view on MongoDB collections * Explore tables, views, procedures, functions, MongoDB collections * SQL editor, execute SQL script, SQL code formatter, SQL code completion, SQL join wizard * Mongo JavaScript editor, execute Mongo script (with NodeJs syntax) From 137bb7b0023cf1923076b028ec7442ec04f78ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Fri, 23 Apr 2021 11:59:13 -0300 Subject: [PATCH 2/2] fix: catch getViewTexts errors otherwise no structure can be seen if somehow SHOW CREATE VIEW fails (invalid refs, permissions) it throw an error and no structure is shown at all. --- plugins/dbgate-plugin-mysql/src/backend/Analyser.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/dbgate-plugin-mysql/src/backend/Analyser.js b/plugins/dbgate-plugin-mysql/src/backend/Analyser.js index 9e1f043bb..36159e076 100644 --- a/plugins/dbgate-plugin-mysql/src/backend/Analyser.js +++ b/plugins/dbgate-plugin-mysql/src/backend/Analyser.js @@ -79,8 +79,13 @@ class Analyser extends DatabaseAnalyser { async getViewTexts(allViewNames) { const res = {}; for (const viewName of this.getRequestedViewNames(allViewNames)) { - const resp = await this.driver.query(this.pool, `SHOW CREATE VIEW \`${viewName}\``); - res[viewName] = resp.rows[0]['Create View']; + try { + const resp = await this.driver.query(this.pool, `SHOW CREATE VIEW \`${viewName}\``); + res[viewName] = resp.rows[0]['Create View']; + } catch(err) { + console.log('ERROR', err); + res[viewName] = `${err}`; + } } return res; }