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