diff --git a/packages/server/src/integrations/base/IntegrationBase.ts b/packages/server/src/integrations/base/IntegrationBase.ts index ce92a10fce..a48713997a 100644 --- a/packages/server/src/integrations/base/IntegrationBase.ts +++ b/packages/server/src/integrations/base/IntegrationBase.ts @@ -1,6 +1,6 @@ export interface IntegrationBase { - create?(query: any): Promise<[any]> - read?(query: any): Promise<[any]> - update?(query: any): Promise<[any]> - delete?(query: any): Promise<[any]> + create?(query: any): Promise + read?(query: any): Promise + update?(query: any): Promise + delete?(query: any): Promise } diff --git a/packages/server/src/integrations/oracle.ts b/packages/server/src/integrations/oracle.ts index 336feac91f..532a1befd1 100644 --- a/packages/server/src/integrations/oracle.ts +++ b/packages/server/src/integrations/oracle.ts @@ -9,7 +9,7 @@ import { finaliseExternalTables, getSqlQuery, buildExternalTableId, - convertType, + convertSqlType, } from "./utils" import oracledb, { ExecuteOptions, @@ -82,15 +82,6 @@ module OracleModule { const UNSUPPORTED_TYPES = ["BLOB", "CLOB", "NCLOB"] - const TYPE_MAP = { - long: FieldTypes.LONGFORM, - number: FieldTypes.NUMBER, - binary_float: FieldTypes.NUMBER, - binary_double: FieldTypes.NUMBER, - timestamp: FieldTypes.DATETIME, - date: FieldTypes.DATETIME, - } - /** * Raw query response */ @@ -292,7 +283,7 @@ module OracleModule { return FieldTypes.BOOLEAN } - return convertType(column.type, TYPE_MAP) + return convertSqlType(column.type) } /** @@ -393,26 +384,26 @@ module OracleModule { return oracledb.getConnection(attributes) } - async create(query: SqlQuery | string) { - const response = await this.internalQuery(getSqlQuery(query)) + async create(query: SqlQuery | string): Promise { + const response = await this.internalQuery(getSqlQuery(query)) return response.rows && response.rows.length ? response.rows : [{ created: true }] } - async read(query: SqlQuery | string) { - const response = await this.internalQuery(getSqlQuery(query)) - return response.rows + async read(query: SqlQuery | string): Promise { + const response = await this.internalQuery(getSqlQuery(query)) + return response.rows ? response.rows : [] } - async update(query: SqlQuery | string) { + async update(query: SqlQuery | string): Promise { const response = await this.internalQuery(getSqlQuery(query)) return response.rows && response.rows.length ? response.rows : [{ updated: true }] } - async delete(query: SqlQuery | string) { + async delete(query: SqlQuery | string): Promise { const response = await this.internalQuery(getSqlQuery(query)) return response.rows && response.rows.length ? response.rows diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 4ddc99e22e..594fee1b65 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -32,6 +32,10 @@ const SQL_TYPE_MAP = { fixed: FieldTypes.NUMBER, datetime: FieldTypes.DATETIME, tinyint: FieldTypes.BOOLEAN, + long: FieldTypes.LONGFORM, + number: FieldTypes.NUMBER, + binary_float: FieldTypes.NUMBER, + binary_double: FieldTypes.NUMBER, } export enum SqlClients {