fix(MySQL Node): Resolve expressions in v1 (#7464)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Michael Kret
2023-10-20 11:09:39 +03:00
committed by GitHub
parent bc473655fb
commit 5c46bb09c1
3 changed files with 197 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import type mysql2 from 'mysql2/promise';
import { createConnection, searchTables } from './GenericFunctions';
import { oldVersionNotice } from '@utils/descriptions';
import { getResolvables } from '@utils/utilities';
const versionDescription: INodeTypeDescription = {
displayName: 'MySQL',
@@ -306,8 +307,15 @@ export class MySqlV1 implements INodeType {
// ----------------------------------
try {
const queryQueue = items.map(async (item, index) => {
const rawQuery = this.getNodeParameter('query', index) as string;
const queryQueue = items.map(async (_, index) => {
let rawQuery = (this.getNodeParameter('query', index) as string).trim();
for (const resolvable of getResolvables(rawQuery)) {
rawQuery = rawQuery.replace(
resolvable,
this.evaluateExpression(resolvable, index) as string,
);
}
return connection.query(rawQuery);
});