From 8722392f0d2bfe0d8b81b2e19a846e87d31cd59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 1 Nov 2023 15:28:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-108103=20Starrocks=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90=E4=B8=8D=E5=8C=85=E5=90=AB?= =?UTF-8?q?catalog=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 13 +++++++++---- .../pages/maintain/forms/components/form.jdbc.ts | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) 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) { From 19c5bc82722278d6527fb07725ee1f2767af55e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 1 Nov 2023 15:36:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-108103=20Starrocks=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90=E4=B8=8D=E5=8C=85=E5=90=AB?= =?UTF-8?q?catalog=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 13 +++++++++---- .../pages/maintain/forms/components/form.jdbc.ts | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) 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) {