1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix: improved handling of query comments, fixes #963 and #580

This commit is contained in:
2025-03-31 13:57:41 +02:00
parent ba63b049a3
commit d912faa850
8 changed files with 201 additions and 107 deletions

View File

@@ -2,6 +2,7 @@ import SSH2Promise = require('@fabio286/ssh2-promise');
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
import dataTypes from 'common/data-types/mysql';
import * as antares from 'common/interfaces/antares';
import { removeComments } from 'common/libs/sqlUtils';
import * as mysql from 'mysql2/promise';
import * as EncodingToCharset from '../../../../node_modules/mysql2/lib/constants/encoding_charset.js';
@@ -1751,7 +1752,7 @@ export class MySQLClient extends BaseClient {
};
if (!args.comments)
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
sql = removeComments(sql);
const nestTables = args.nest ? '.' : false;
const resultsArr: antares.QueryResult[] = [];