Skip to content

Commit

Permalink
fix: create table issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alihm committed Aug 5, 2023
1 parent 04f2d08 commit 688d309
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ClusterOperator/Backlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ class BackLog {
}, 1000 * 30);
this.writeLock = false;
let result = null;
let setSession = false;
if (query.toLowerCase().startsWith('create')) {
// Fixes SQL error when creating tables
// eslint-disable-next-line no-param-reassign
query = `SET SESSION sql_mode='IGNORE_SPACE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';${query}`;
setSession = true;
}
if (connId === false) {
if (setSession) await this.UserDBClient.query("SET SESSION sql_mode='IGNORE_SPACE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'", false, fullQuery);
result = await this.UserDBClient.query(query, false, fullQuery);
} else if (connId >= 0) {
if (setSession) await ConnectionPool.getConnectionById(connId).query("SET SESSION sql_mode='IGNORE_SPACE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'", false, fullQuery);
result = await ConnectionPool.getConnectionById(connId).query(query, false, fullQuery);
}
if (Array.isArray(result) && result[2]) {
Expand Down

0 comments on commit 688d309

Please sign in to comment.