@ -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 } ` : '' )