Browse Source

Merge pull request #145 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:release/10.0 to release/10.0

* commit '8e6e3464ad396856ad3c57b8cb5fea766e22d9a5':
  fix: DEC-11782 oracle数据连接url端口号和数据库之间可能是/或:
research/10.0
alan 5 years ago
parent
commit
7894580c97
  1. 12
      src/modules/__test__/app.test.ts
  2. 2
      src/modules/app.service.ts

12
src/modules/__test__/app.test.ts

@ -58,6 +58,18 @@ test('解析url', () => {
databaseName: 'database', databaseName: 'database',
urlInfo: '', urlInfo: '',
}); });
expect(resolveUrlInfo('jdbc:oracle:thin:@192.168.5.143:1521/orcl')).toEqual({
host: '192.168.5.143',
port: '1521',
databaseName: 'orcl',
urlInfo: '',
});
expect(resolveUrlInfo('jdbc:oracle:thin:@192.168.5.143:1521:orcl')).toEqual({
host: '192.168.5.143',
port: '1521',
databaseName: 'orcl',
urlInfo: '',
});
}); });
test('数据库可能为空', () => { test('数据库可能为空', () => {

2
src/modules/app.service.ts

@ -49,7 +49,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
export function resolveUrlInfo (url: string) { export function resolveUrlInfo (url: string) {
if (BI.isNull(url)) return {}; if (BI.isNull(url)) return {};
const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:)([^]+)(.*)/i); const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/)([^]+)(.*)/i);
if (oracleUlr) { if (oracleUlr) {
return { return {
host: oracleUlr[5], host: oracleUlr[5],

Loading…
Cancel
Save