From 6bc6a08c832448fa32ab17910729f1966118ba51 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 2 Jan 2020 00:45:45 +0200 Subject: [PATCH] Quote table names in plugin database explorer --- .../frontend/src/pages/dashboard/InstanceDatabase.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maubot/management/frontend/src/pages/dashboard/InstanceDatabase.js b/maubot/management/frontend/src/pages/dashboard/InstanceDatabase.js index 8cb34ae..73a101b 100644 --- a/maubot/management/frontend/src/pages/dashboard/InstanceDatabase.js +++ b/maubot/management/frontend/src/pages/dashboard/InstanceDatabase.js @@ -90,7 +90,7 @@ class InstanceDatabase extends Component { } buildSQLQuery(table = this.state.selectedTable, resetContent = true) { - let query = `SELECT * FROM ${table}` + let query = `SELECT * FROM "${table}"` if (this.order.size > 0) { const order = Array.from(this.order.entries()).reverse() @@ -198,10 +198,10 @@ class InstanceDatabase extends Component { const val = values[index] condition.push(`${key}='${this.sqlEscape(val.toString())}'`) } - const query = `DELETE FROM ${this.state.selectedTable} WHERE ${condition.join(" AND ")}` + const query = `DELETE FROM "${this.state.selectedTable}" WHERE ${condition.join(" AND ")}` const res = await api.queryInstanceDatabase(this.props.instanceID, query) this.setState({ - prevQuery: `DELETE FROM ${this.state.selectedTable} ...`, + prevQuery: `DELETE FROM "${this.state.selectedTable}" ...`, rowCount: res.rowcount, }) await this.reloadContent(false)