Fixes after testing against actual Oracle service.
This commit is contained in:
parent
832f8b3aa8
commit
9f57d7c33a
|
@ -47,7 +47,10 @@ async function getConnector(
|
|||
datasource: Datasource
|
||||
): Promise<IntegrationBase | DatasourcePlus> {
|
||||
const Connector = await getIntegration(datasource.source)
|
||||
datasource = await sdk.datasources.enrich(datasource)
|
||||
// can't enrich if it doesn't have an ID yet
|
||||
if (datasource._id) {
|
||||
datasource = await sdk.datasources.enrich(datasource)
|
||||
}
|
||||
// Connect to the DB and build the schema
|
||||
return new Connector(datasource.config)
|
||||
}
|
||||
|
@ -127,13 +130,19 @@ export async function verify(
|
|||
ctx: UserCtx<VerifyDatasourceRequest, VerifyDatasourceResponse>
|
||||
) {
|
||||
const { datasource } = ctx.request.body
|
||||
const existingDatasource = await sdk.datasources.get(datasource._id!)
|
||||
|
||||
const enrichedDatasource = sdk.datasources.mergeConfigs(
|
||||
datasource,
|
||||
existingDatasource
|
||||
)
|
||||
|
||||
let existingDatasource: undefined | Datasource
|
||||
try {
|
||||
existingDatasource = await sdk.datasources.get(datasource._id!)
|
||||
} catch (err) {
|
||||
// doesn't exist - can ignore, first creation
|
||||
}
|
||||
let enrichedDatasource = datasource
|
||||
if (existingDatasource) {
|
||||
enrichedDatasource = sdk.datasources.mergeConfigs(
|
||||
datasource,
|
||||
existingDatasource
|
||||
)
|
||||
}
|
||||
const connector = await getConnector(enrichedDatasource)
|
||||
if (!connector.testConnection) {
|
||||
ctx.throw(400, "Connection information verification not supported")
|
||||
|
|
|
@ -22,7 +22,8 @@ import { FieldTypes } from "../constants"
|
|||
import {
|
||||
BindParameters,
|
||||
Connection,
|
||||
ConnectionAttributes, DBError,
|
||||
ConnectionAttributes,
|
||||
DBError,
|
||||
ExecuteOptions,
|
||||
Result,
|
||||
} from "oracledb"
|
||||
|
@ -330,6 +331,7 @@ class OracleIntegration extends Sql implements DatasourcePlus {
|
|||
let connection
|
||||
try {
|
||||
connection = await this.getConnection()
|
||||
response.connected = true
|
||||
} catch (err: any) {
|
||||
response.connected = false
|
||||
response.error = err.message
|
||||
|
|
Loading…
Reference in New Issue