Browse Source

fix(api): add missing decimal and integer types

feat/oracle-support
Pranav C 2 years ago committed by Pranav C
parent
commit
9eaa037e1d
  1. 28
      packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts

28
packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts

@ -2,12 +2,20 @@ import UITypes from '../UITypes';
import { IDType } from './index'; import { IDType } from './index';
// Ref - https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT513 // Ref - https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT513
// https://docs.oracle.com/cd/B19306_01/olap.102/b14346/dml_datatypes002.htm
const dbTypes = [ const dbTypes = [
'CHAR', 'CHAR',
'VARCHAR', 'VARCHAR',
'VARCHAR2', 'VARCHAR2',
'NUMBER', 'NUMBER',
'INTEGER',
'SHORTINTEGER',
'LONGINTEGER',
'DECIMAL',
'SHORTDECIMAL',
'NCHAR', 'NCHAR',
'NVARCHAR2', 'NVARCHAR2',
'CLOB', 'CLOB',
@ -35,6 +43,7 @@ const dbTypes = [
'XMLType', 'XMLType',
'UriType', 'UriType',
]; ];
export class OracleUi { export class OracleUi {
static getNewTableColumns(): any[] { static getNewTableColumns(): any[] {
return [ return [
@ -435,6 +444,13 @@ export class OracleUi {
case 'NCLOB': case 'NCLOB':
return 'string'; return 'string';
case 'INTEGER':
case 'SHORTINTEGER':
case 'LONGINTEGER':
return 'integer';
case 'DECIMAL':
case 'SHORTDECIMAL':
case 'NUMBER': case 'NUMBER':
case 'BINARY_FLOAT': case 'BINARY_FLOAT':
case 'BINARY_DOUBLE': case 'BINARY_DOUBLE':
@ -573,10 +589,10 @@ export class OracleUi {
colProp.dt = 'NUMBER'; colProp.dt = 'NUMBER';
break; break;
case 'Decimal': case 'Decimal':
colProp.dt = 'NUMBER'; colProp.dt = 'DECIMAL';
break; break;
case 'Currency': case 'Currency':
colProp.dt = 'NUMBER'; colProp.dt = 'DECIMAL';
colProp.validate = { colProp.validate = {
func: ['isCurrency'], func: ['isCurrency'],
args: [''], args: [''],
@ -712,13 +728,13 @@ export class OracleUi {
]; ];
case 'Number': case 'Number':
return ['NUMBER']; return ['INTEGER', 'SHORTINTEGER', 'LONGINTEGER', 'NUMBER'];
case 'Decimal': case 'Decimal':
return ['NUMBER']; return ['DECIMAL', 'SHORTDECIMAL', 'NUMBER'];
case 'Currency': case 'Currency':
return ['NUMBER']; return ['DECIMAL', 'SHORTDECIMAL', 'NUMBER'];
case 'Percent': case 'Percent':
return ['NUMBER']; return ['NUMBER'];
@ -734,7 +750,6 @@ export class OracleUi {
case 'Date': case 'Date':
return [ return [
'DATE', 'DATE',
'TIMESTAMP', 'TIMESTAMP',
'TIMESTAMP WITH LOCAL TIME ZONE', 'TIMESTAMP WITH LOCAL TIME ZONE',
'TIMESTAMP WITH TIME ZONE', 'TIMESTAMP WITH TIME ZONE',
@ -745,7 +760,6 @@ export class OracleUi {
case 'LastModifiedTime': case 'LastModifiedTime':
return [ return [
'DATE', 'DATE',
'TIMESTAMP', 'TIMESTAMP',
'TIMESTAMP WITH LOCAL TIME ZONE', 'TIMESTAMP WITH LOCAL TIME ZONE',
'TIMESTAMP WITH TIME ZONE', 'TIMESTAMP WITH TIME ZONE',

Loading…
Cancel
Save