Browse Source

Merge pull request #8316 in DEC/decision-webui-dcm from release/11.0 to bugfix/11.0

* commit 'e458bbdf2917d5939a97aa19d696ef14dbb25ca8':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
bugfix/11.0
superman 1 year ago
parent
commit
06248f2d33
  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