Skip to content

Commit

Permalink
query fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc-bq committed Feb 4, 2025
1 parent 89f2705 commit 2860b1a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion mysql/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,24 @@ export class AwsMySQLClient extends AwsClient {
}

async query(options: QueryOptions, callback?: any): Promise<Query> {
return await this.targetClient?.client?.query(options, callback);
if (!this.isConnected) {
await this.connect(); // client.connect is not required for MySQL clients
this.isConnected = true;
}
const host = this.pluginService.getCurrentHostInfo();
const context = this.telemetryFactory.openTelemetryContext("awsClient.query", TelemetryTraceLevel.TOP_LEVEL);
return await context.start(async () => {
return await this.pluginManager.execute(
host,
this.properties,
"query",
async () => {
await this.pluginService.updateState(options.sql);
return await ClientUtils.queryWithTimeout(this.targetClient?.client?.query(options, callback), this.properties);
},
options
);
});
}

private async queryWithoutUpdate(options: QueryOptions, callback?: any): Promise<Query> {
Expand Down

0 comments on commit 2860b1a

Please sign in to comment.