Skip to content

Commit

Permalink
fix: semicolon inside strings breaks queries, closes #59
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Apr 28, 2021
1 parent 04cd806 commit 1b09909
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"faker": "^5.3.1",
"marked": "^2.0.2",
"moment": "^2.29.1",
"mssql": "^6.2.3",
"mssql": "^6.3.1",
"mysql2": "^2.2.5",
"node-sql-parser": "^3.1.0",
"pg": "^8.5.1",
Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/MySQLClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ export class MySQLClient extends AntaresCore {
const nestTables = args.nest ? '.' : false;
const resultsArr = [];
let paramsArr = [];
const queries = args.split ? sql.split(';') : [sql];
const queries = args.split ? sql.split(/(?!\B['"][^'"]*);(?![^'"]*['"]\B)/gm) : [sql];

if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder

Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/PostgreSQLClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ export class PostgreSQLClient extends AntaresCore {

const resultsArr = [];
let paramsArr = [];
const queries = args.split ? sql.split(';') : [sql];
const queries = args.split ? sql.split(/(?!\B'[^']*);(?![^']*'\B)/gm) : [sql];

if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder

Expand Down

0 comments on commit 1b09909

Please sign in to comment.