Browse Source

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

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

* commit '19c5bc82722278d6527fb07725ee1f2767af55e8':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
final/11.0
fanglei-方磊 1 year ago
parent
commit
92f35b62c3
  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 // 拼接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')) { if (baseUrl.startsWith('jdbc:sqlserver')) {
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('=database', `=${database}`); .replace('=database', `=${database}`);
@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', ''); .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}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('default_catalog', catalog) .replace('default_catalog.database', databaseStr);
.replace('database', database)
} }
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') 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) { private onHostPortChange(database) {
const { urls, url } = databaseType; const { urls, url, databaseType } = database;
const driver = this.form.driver.getValue(); const driver = this.form.driver.getValue();
const selectUrl = BI.get(urls, driver.driver) || url; const selectUrl = BI.get(urls, driver.driver) || url;
const host = this.form.host.getValue(); const host = this.form.host.getValue();
const port = this.form.port.getValue(); const port = this.form.port.getValue();
const catalog = this.form.catalog.getValue(); const catalog = this.form.catalog.getValue();
const database = this.form.database.getValue(); const databaseName = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl)); this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType));
} }
private onSshTypeChange(sshType) { private onSshTypeChange(sshType) {

Loading…
Cancel
Save