mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
fix(MySQL Node): Only escape table names when needed (#8246)
This commit is contained in:
@@ -13,7 +13,7 @@ import type {
|
||||
WhereClause,
|
||||
} from '../../helpers/interfaces';
|
||||
|
||||
import { addWhereClauses } from '../../helpers/utils';
|
||||
import { addWhereClauses, escapeSqlIdentifier } from '../../helpers/utils';
|
||||
|
||||
import {
|
||||
optionsCollection,
|
||||
@@ -98,11 +98,11 @@ export async function execute(
|
||||
let values: QueryValues = [];
|
||||
|
||||
if (deleteCommand === 'drop') {
|
||||
query = `DROP TABLE IF EXISTS \`${table}\``;
|
||||
query = `DROP TABLE IF EXISTS ${escapeSqlIdentifier(table)}`;
|
||||
}
|
||||
|
||||
if (deleteCommand === 'truncate') {
|
||||
query = `TRUNCATE TABLE \`${table}\``;
|
||||
query = `TRUNCATE TABLE ${escapeSqlIdentifier(table)}`;
|
||||
}
|
||||
|
||||
if (deleteCommand === 'delete') {
|
||||
@@ -114,7 +114,7 @@ export async function execute(
|
||||
[query, values] = addWhereClauses(
|
||||
this.getNode(),
|
||||
i,
|
||||
`DELETE FROM \`${table}\``,
|
||||
`DELETE FROM ${escapeSqlIdentifier(table)}`,
|
||||
whereClauses,
|
||||
values,
|
||||
combineConditions,
|
||||
|
||||
Reference in New Issue
Block a user