Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/lib/client_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ClientWrapper {
readonly properties: Map<string, any>;
readonly id: string;

query(sql: any): Promise<any>;
query(sql: string): Promise<any>;

end(): Promise<void>;

Expand Down
7 changes: 4 additions & 3 deletions common/lib/mysql_client_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export class MySQLClientWrapper implements ClientWrapper {
this.id = uniqueId("MySQLClient_");
}

query(sql: any): Promise<any> {
this.driverDialect.setQueryTimeout(this.properties, sql);
return this.client?.query(sql);
query(sql: string): Promise<any> {
const query = { sql: sql };
this.driverDialect.setQueryTimeout(this.properties, query);
return this.client?.query(query);
}

async queryWithTimeout(sql: string): Promise<any> {
Expand Down
2 changes: 1 addition & 1 deletion common/lib/pg_client_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class PgClientWrapper implements ClientWrapper {
this.id = uniqueId("PgClient_");
}

query(sql: any): Promise<any> {
query(sql: string): Promise<any> {
return this.client?.query(sql);
}

Expand Down
2 changes: 1 addition & 1 deletion common/lib/pool_client_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class PoolClientWrapper implements ClientWrapper {
return this.end();
}

query(sql: any): Promise<any> {
query(sql: string): Promise<any> {
return this.client?.query(sql);
}

Expand Down
6 changes: 3 additions & 3 deletions mysql/lib/dialect/mysql2_driver_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export class MySQL2DriverDialect implements DriverDialect {
}
}

setQueryTimeout(props: Map<string, any>, sql?: any, wrapperConnectTimeout?: any) {
const timeout = wrapperConnectTimeout ?? props.get(WrapperProperties.WRAPPER_QUERY_TIMEOUT.name);
setQueryTimeout(props: Map<string, any>, sql?: any, wrapperQueryTimeout?: any) {
const timeout = wrapperQueryTimeout ?? props.get(WrapperProperties.WRAPPER_QUERY_TIMEOUT.name);
if (timeout && !sql[MySQL2DriverDialect.QUERY_TIMEOUT_PROPERTY_NAME]) {
sql[MySQL2DriverDialect.QUERY_TIMEOUT_PROPERTY_NAME] = timeout;
sql[MySQL2DriverDialect.QUERY_TIMEOUT_PROPERTY_NAME] = Number(timeout);
}
}

Expand Down
2 changes: 1 addition & 1 deletion mysql/lib/dialect/mysql_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class MySQLDatabaseDialect implements DatabaseDialect {
try {
return await ClientUtils.queryWithTimeout(
targetClient
.query({ sql: "SELECT 1" })
.query("SELECT 1")
.then(() => {
return true;
})
Expand Down