Browse Source

Merge pull request #8317 in DEC/decision-webui-dcm from bugfix/11.0 to feature/x

* commit '06248f2d33170e10a873882518ebc3c31ed17e23':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
feature/x
superman 1 year ago
parent
commit
21cef90c1b
  1. 28
      src/modules/app.provider.ts

28
src/modules/app.provider.ts

@ -6,7 +6,7 @@ BI.provider('dec.connection.provider.datebase', function () {
function starRocksResolve(url: string) {
// 处理starRocks数据连接常规模式
const result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i);
let result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i);
if (result) {
return {
host: result[1],
@ -15,9 +15,21 @@ BI.provider('dec.connection.provider.datebase', function () {
databaseName: result[4],
urlInfo: result[0],
};
} else {
// 兼容老数据库里面没有catalog的情况
result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([^]+)(.*)/i);
if (result) {
return {
host: result[1],
port: result[2] === 'port' ? '' : result[2],
catalog: '',
databaseName: result[3],
urlInfo: result[0],
};
}
}
// 处理starRocks数据连接负载均衡模式
const loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i);
let loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i);
if (loadBalance) {
return {
host: '',
@ -26,6 +38,18 @@ BI.provider('dec.connection.provider.datebase', function () {
databaseName: loadBalance[2],
urlInfo: loadBalance[0],
}
} else {
// 兼容老数据库里面没有catalog的情况
loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)([^/]+)/i);
if (loadBalance) {
return {
host: '',
port: '',
catalog: '',
databaseName: loadBalance[1],
urlInfo: loadBalance[0],
}
}
}
return {
host: '',

Loading…
Cancel
Save