Browse Source

Pull request #8318: REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错

Merge in DEC/decision-webui-dcm from ~FANGLEI/decision-webui-dcm:release/11.0 to release/11.0

* commit '8722392f0d2bfe0d8b81b2e19a846e87d31cd59f':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
release/11.0
fanglei-方磊 1 year ago
parent
commit
88737a11bf
  1. 13
      src/modules/app.service.ts
  2. 8
      src/modules/pages/maintain/forms/components/form.jdbc.ts

13
src/modules/app.service.ts

@ -61,7 +61,7 @@ export function resolveUrlInfo(url: string, database?: string) {
}
// 拼接url
export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string) {
export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string, databaseType: string) {
if (baseUrl.startsWith('jdbc:sqlserver')) {
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('=database', `=${database}`);
@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', '');
}
if (catalog) {
if (databaseType === 'starrocks') {
let databaseStr = '';
if (!catalog || !database) {
databaseStr = catalog + database;
} else {
databaseStr = catalog + '.' + database;
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('default_catalog', catalog)
.replace('database', database)
.replace('default_catalog.database', databaseStr);
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')

8
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -1601,15 +1601,15 @@ export class FormJdbc extends BI.Widget {
];
}
private onHostPortChange(databaseType) {
const { urls, url } = databaseType;
private onHostPortChange(database) {
const { urls, url, databaseType } = database;
const driver = this.form.driver.getValue();
const selectUrl = BI.get(urls, driver.driver) || url;
const host = this.form.host.getValue();
const port = this.form.port.getValue();
const catalog = this.form.catalog.getValue();
const database = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl));
const databaseName = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType));
}
private onSshTypeChange(sshType) {

Loading…
Cancel
Save