Implement the check as part of the integration

This commit is contained in:
Adria Navarro 2023-05-12 12:49:08 +02:00
parent fd18529135
commit 0418e90a37
1 changed files with 9 additions and 11 deletions

View File

@ -121,6 +121,15 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
}
}
async testConnection() {
try {
await this.connect()
return true
} catch (e: any) {
return { error: e.message as string }
}
}
getBindingIdentifier(): string {
return `@p${this.index++}`
}
@ -310,18 +319,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
}
}
async function validateConnection(config: MSSQLConfig) {
const integration = new SqlServerIntegration(config)
try {
await integration.connect()
return true
} catch (e: any) {
return { error: e.message as string }
}
}
export default {
schema: SCHEMA,
integration: SqlServerIntegration,
validateConnection,
}