mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(MySQL Node): Only escape table names when needed (#8246)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { IDataObject, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
||||
import { Client } from 'ssh2';
|
||||
import { createPool } from '../transport';
|
||||
import { escapeSqlIdentifier } from '../helpers/utils';
|
||||
|
||||
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const credentials = await this.getCredentials('mySql');
|
||||
@@ -22,7 +23,9 @@ export async function getColumns(this: ILoadOptionsFunctions): Promise<INodeProp
|
||||
|
||||
const columns = (
|
||||
await connection.query(
|
||||
`SHOW COLUMNS FROM \`${table}\` FROM \`${credentials.database as string}\``,
|
||||
`SHOW COLUMNS FROM ${escapeSqlIdentifier(table)} FROM ${escapeSqlIdentifier(
|
||||
credentials.database as string,
|
||||
)}`,
|
||||
)
|
||||
)[0] as IDataObject[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user