From 38001453af1494a06e6dbe9d265bc1e1503ac80e Mon Sep 17 00:00:00 2001 From: alan Date: Sun, 29 Sep 2019 16:45:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-10161=20=E5=8C=B9=E9=85=8D=E4=BB=8E?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8A=E6=B7=BB=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 11 +++-------- src/modules/constants/constant.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index eac2173..9200db4 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,4 +1,4 @@ -import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER } from '@constants/constant'; +import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant'; import { CONSTANT_PLUGIN_TYPES, CONSTANT_PLUGIN_SHOW, CONSTANT_PLUGIN_EDIT } from '@constants/plugin'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; @@ -29,13 +29,8 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT if (database && DATA_BASE_TYPES.some(item => item.databaseType === database)) { databaseType = DATA_BASE_TYPES.find(item => item.databaseType === database); } else { - databaseType = (DATA_BASE_TYPES as DatabaseType[]).find(item => { - if (item.drivers) { - return item.drivers.includes(driver); - } - - return item.driver === driver; - }); + const desingDatabase = DESIGN_DRIVER_TYPE.find(item => item.driver === driver); + databaseType = DATA_BASE_TYPES.find(item => item.databaseType === BI.get(desingDatabase, 'type')); } if (!databaseType) { return DATA_BASE_TYPES_OTHER; diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 0be47ff..8734919 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -166,6 +166,36 @@ export const DATA_BASE_DRIVER_LINK = DecCst && DecCst.Hyperlink ? [ link: DecCst.Hyperlink.Database.OTHER, }, ] : []; +export const DESIGN_DRIVER_TYPE = [ + { + type: 'mysql', + driver: 'com.mysql.jdbc.Driver', + }, + { + type: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + }, + { + type: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + }, + { + type: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + }, + { + type: 'postgresql', + driver: 'org.postgresql.Driver', + }, + { + type: 'sqlite', + driver: 'org.sqlite.JDBC', + }, + { + type: 'transwarp-inceptor', + driver: 'org.apache.hive.jdbc.HiveDriver', + }, +]; export const DATA_BASE_TYPES = [ { text: 'ADS',