diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d33bb97..d38fdc5 100644 --- a/src/modules/app.service.ts +++ b/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}` : '') diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index cb41e3a..20e53cc 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/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) {