feat(MySQL Node): Hints for executeQuery and select operations (#16753)

This commit is contained in:
Michael Kret
2025-07-04 13:57:18 +03:00
committed by GitHub
parent 945098d789
commit f2eb38617f
8 changed files with 159 additions and 72 deletions

View File

@@ -70,7 +70,7 @@ export const optionsCollection: INodeProperties = {
description: 'A single query for all incoming items',
},
{
name: 'Independently',
name: 'Independent',
value: BATCH_MODE.INDEPENDENTLY,
description: 'Execute one query per incoming item of the run',
},

View File

@@ -3,6 +3,7 @@ import { NodeOperationError } from 'n8n-workflow';
import * as database from './database/Database.resource';
import type { MySqlType } from './node.type';
import { addExecutionHints } from '../../../../utils/utilities';
import type { MysqlNodeCredentials, QueryRunner } from '../helpers/interfaces';
import { configureQueryRunner } from '../helpers/utils';
import { createPool } from '../transport';
@@ -10,11 +11,13 @@ import { createPool } from '../transport';
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
let returnData: INodeExecutionData[] = [];
const items = this.getInputData();
const resource = this.getNodeParameter<MySqlType>('resource', 0);
const operation = this.getNodeParameter('operation', 0);
const nodeOptions = this.getNodeParameter('options', 0);
const node = this.getNode();
nodeOptions.nodeVersion = this.getNode().typeVersion;
nodeOptions.nodeVersion = node.typeVersion;
const credentials = await this.getCredentials<MysqlNodeCredentials>('mySql');
@@ -30,8 +33,6 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
try {
switch (mysqlNodeData.resource) {
case 'database':
const items = this.getInputData();
returnData = await database[mysqlNodeData.operation].execute.call(
this,
items,
@@ -49,5 +50,7 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
await pool.end();
}
addExecutionHints(this, node, items, operation, node.executeOnce);
return [returnData];
}