Skip to content

Commit

Permalink
fix: some issues related to previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Feb 12, 2024
1 parent 876d5ea commit 259d051
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ export class MySQLClient extends BaseClient {
return connection;
}

private async getConnection (args: antares.QueryParams, retry?: boolean): Promise<mysql.Pool | mysql.PoolConnection | mysql.Connection> {
async getConnection (args?: antares.QueryParams, retry?: boolean): Promise<mysql.Pool | mysql.PoolConnection | mysql.Connection> {
let connection;

try {
if (!args.autocommit && args.tabUid) { // autocommit OFF
if (args && !args.autocommit && args.tabUid) { // autocommit OFF
if (this._connectionsToCommit.has(args.tabUid))
connection = this._connectionsToCommit.get(args.tabUid);
else {
Expand All @@ -276,12 +276,12 @@ export class MySQLClient extends BaseClient {
else// autocommit ON
connection = this.isPool ? await (this._connection as mysql.Pool).getConnection() : this._connection;

if (args.tabUid && this.isPool) {
if (args && args.tabUid && this.isPool) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this._runningConnections.set(args.tabUid, (connection as any).connection.connectionId);
}

if (args.schema)
if (args && args.schema)
await connection.query(`USE \`${args.schema}\``);

return connection;
Expand Down

0 comments on commit 259d051

Please sign in to comment.