From 1d53581f1797cde2f939fc865b224be1733b1419 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 17 Nov 2021 16:41:00 +0000 Subject: [PATCH] Datatypes working --- packages/server/src/integrations/oracle.ts | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/server/src/integrations/oracle.ts b/packages/server/src/integrations/oracle.ts index 34f01c8180..f382cf0aa4 100644 --- a/packages/server/src/integrations/oracle.ts +++ b/packages/server/src/integrations/oracle.ts @@ -69,28 +69,19 @@ module OracleModule { }, } + const UNSUPPORTED_TYPES = [ + "BLOB", + "CLOB", + "NCLOB" + ] + const TYPE_MAP = { - text: FieldTypes.LONGFORM, - blob: FieldTypes.LONGFORM, - enum: FieldTypes.STRING, - varchar: FieldTypes.STRING, - float: FieldTypes.NUMBER, - int: FieldTypes.NUMBER, - numeric: FieldTypes.NUMBER, - bigint: FieldTypes.NUMBER, - mediumint: FieldTypes.NUMBER, - decimal: FieldTypes.NUMBER, - dec: FieldTypes.NUMBER, - double: FieldTypes.NUMBER, - real: FieldTypes.NUMBER, - fixed: FieldTypes.NUMBER, - smallint: FieldTypes.NUMBER, + long: FieldTypes.LONGFORM, + number: FieldTypes.NUMBER, + binary_float: FieldTypes.NUMBER, + binary_double: FieldTypes.NUMBER, timestamp: FieldTypes.DATETIME, date: FieldTypes.DATETIME, - datetime: FieldTypes.DATETIME, - time: FieldTypes.DATETIME, - tinyint: FieldTypes.BOOLEAN, - json: DatasourceFieldTypes.JSON, } /** @@ -236,6 +227,14 @@ module OracleModule { return oracleTables } + private isSupportedColumn(column: OracleColumn) { + if (UNSUPPORTED_TYPES.includes(column.type)) { + return false + } + + return true + } + /** * Fetches the tables from the oracle table and assigns them to the datasource. * @param {*} datasourceId - datasourceId to fetch @@ -262,6 +261,8 @@ module OracleModule { // iterate each column on the table Object.values(oracleTable.columns) + // remove columns that we can't read / save + .filter(oracleColumn => this.isSupportedColumn(oracleColumn)) // match the order of the columns in the db .sort((c1, c2) => c1.id - c2.id) .forEach(oracleColumn => { @@ -290,7 +291,6 @@ module OracleModule { this.schemaErrors = final.errors } - private async internalQuery(query: SqlQuery): Promise> { let connection try { @@ -345,7 +345,7 @@ module OracleModule { async query(json: QueryJson) { const operation = this._operation(json).toLowerCase() - const input = this._query(json) + const input = this._query(json, { disableReturning: true }) if (Array.isArray(input)) { const responses = [] for (let query of input) {