Skip to content

Commit

Permalink
fix(MySQL): routines do not return results, fixes #885
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Oct 17, 2024
1 parent b6c5dff commit dba490f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1714,9 +1714,10 @@ export class MySQLClient extends BaseClient {
connection.query({ sql: query, nestTables }).then(async ([response, fields]) => {
timeStop = new Date();
const queryResult = response;
const fieldsArr = fields ? Array.isArray(fields[0]) ? fields[0] : fields : false;// Some times fields are nested in an array

let remappedFields = fields
? fields.map(field => {
let remappedFields = fieldsArr
? fieldsArr.map(field => {
if (!field || Array.isArray(field))
return undefined;

Expand Down Expand Up @@ -1785,7 +1786,7 @@ export class MySQLClient extends BaseClient {

resolve({
duration: timeStop.getTime() - timeStart.getTime(),
rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? [] : queryResult : false,
rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? queryResult[0] : queryResult : false,
report: !Array.isArray(queryResult) ? queryResult : false,
fields: remappedFields,
keys: keysArr
Expand Down

0 comments on commit dba490f

Please sign in to comment.