Skip to content

Commit

Permalink
fix(MySQL): invalid JavaScript datetime values not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Apr 16, 2021
1 parent 7d2ace9 commit dcccb54
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/libs/clients/MySQLClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ export class MySQLClient extends AntaresCore {
async connect () {
if (!this._poolSize)
this._connection = mysql.createConnection(this._params);
else
this._connection = mysql.createPool({ ...this._params, connectionLimit: this._poolSize });
else {
this._connection = mysql.createPool({
...this._params,
connectionLimit: this._poolSize,
typeCast: (field, next) => {
if (field.type === 'DATETIME')
return field.string();
else
return next();
}
});
}
}

/**
Expand Down

0 comments on commit dcccb54

Please sign in to comment.