From 3aa2159a1ae3b6785646fc7ac1e866cb0277d087 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Wed, 24 Feb 2021 19:45:27 +0100 Subject: [PATCH] fix(MySQL): issue obtaining routine/function parameters --- src/main/libs/clients/MySQLClient.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 1fd25a51..2a0a3b6d 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -551,18 +551,18 @@ export class MySQLClient extends AntaresCore { } const parameters = row['Create Procedure'] - .match(/(?<=\().*?(?=\))/s)[0] + .match(/(\([^()]*(?:(?:\([^()]*\))[^()]*)*\)\s*)/s)[0] .replaceAll('\r', '') .replaceAll('\t', '') + .slice(1, -1) .split(',') .map(el => { const param = el.split(' '); const type = param[2] ? param[2].replace(')', '').split('(') : ['', null]; - return { name: param[1] ? param[1].replaceAll('`', '') : '', type: type[0].replaceAll('\n', ''), - length: +type[1], + length: +type[1].replace(/\D/g, ''), context: param[0] ? param[0].replace('\n', '') : '' }; }).filter(el => el.name); @@ -671,9 +671,10 @@ export class MySQLClient extends AntaresCore { } const parameters = row['Create Function'] - .match(/(?<=\().*?(?=\))/s)[0] + .match(/(\([^()]*(?:(?:\([^()]*\))[^()]*)*\)\s*)/s)[0] .replaceAll('\r', '') .replaceAll('\t', '') + .slice(1, -1) .split(',') .map(el => { const param = el.split(' '); @@ -682,7 +683,7 @@ export class MySQLClient extends AntaresCore { return { name: param[0] ? param[0].replaceAll('`', '') : '', type: type[0], - length: +type[1] + length: +type[1].replace(/\D/g, '') }; }).filter(el => el.name);