From 07a552dd56e194ccd4c25362cebc723061f81b07 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 22 Nov 2023 07:17:57 +0000 Subject: [PATCH] fix: exclude unsupported functions --- packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts | 23 ++++++++++--------- packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts | 4 ++-- .../nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts | 4 ++-- packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts | 12 +++++++++- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts index e0db70b9ff..e6199ecf31 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts @@ -620,16 +620,17 @@ export class MssqlUi { } { const colProp: any = {}; switch (col.uidt) { - case 'ID': { - const isAutoIncId = idType === 'AI'; - const isAutoGenId = idType === 'AG'; - colProp.dt = isAutoGenId ? 'varchar' : 'int'; - colProp.pk = true; - colProp.un = isAutoIncId; - colProp.ai = isAutoIncId; - colProp.rqd = true; - colProp.meta = isAutoGenId ? {ag: 'nc'} : undefined; - } + case 'ID': + { + const isAutoIncId = idType === 'AI'; + const isAutoGenId = idType === 'AG'; + colProp.dt = isAutoGenId ? 'varchar' : 'int'; + colProp.pk = true; + colProp.un = isAutoIncId; + colProp.ai = isAutoIncId; + colProp.rqd = true; + colProp.meta = isAutoGenId ? { ag: 'nc' } : undefined; + } break; case 'ForeignKey': colProp.dt = 'varchar'; @@ -908,6 +909,6 @@ export class MssqlUi { } static getUnsupportedFnList() { - return []; + return ['XOR', 'REGEX_MATCH', 'REGEX_EXTRACT', 'REGEX_REPLACE', 'VALUE']; } } diff --git a/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts index 6f1747fa8c..533fe8208b 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts @@ -1,4 +1,4 @@ -import { NormalColumnRequestType } from '../Api' +import { NormalColumnRequestType } from '../Api'; import UITypes from '../UITypes'; import { IDType } from './index'; @@ -938,7 +938,7 @@ export class OracleUi { } static getUnsupportedFnList() { - return []; + return ['XOR', 'REGEX_MATCH', 'REGEX_EXTRACT', 'REGEX_REPLACE', 'VALUE']; } } diff --git a/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts index 66188161e9..e1bad9e137 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts @@ -374,7 +374,7 @@ export class SnowflakeUi { static columnEditable(colObj) { return colObj.tn !== '_evolutions' || colObj.tn !== 'nc_evolutions'; } -/* + /* static extractFunctionName(query) { const reg = @@ -972,7 +972,7 @@ export class SnowflakeUi { } static getUnsupportedFnList() { - return []; + return ['XOR', 'REGEX_MATCH', 'REGEX_EXTRACT', 'REGEX_REPLACE', 'VALUE']; } } diff --git a/packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts index 1dba8c6b42..0e81c1b86a 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts @@ -868,6 +868,16 @@ export class SqliteUi { } static getUnsupportedFnList() { - return ['LOG', 'EXP', 'POWER', 'SQRT']; + return [ + 'LOG', + 'EXP', + 'POWER', + 'SQRT', + 'XOR', + 'REGEX_MATCH', + 'REGEX_EXTRACT', + 'REGEX_REPLACE', + 'VALUE', + ]; } }