Skip to content

Commit

Permalink
Quote table names in plugin database explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 1, 2020
1 parent 69362de commit 6bc6a08
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6bc6a08

Please sign in to comment.