fix: handle legacy gbase driver_profile and add MCP driver_profile param
This commit is contained in:
1 parent
d6544ba4be
commit
4aa907d8b5
3 files changed
+12
-6
No files matched your search
@@ -28,15 +28,15 @@ export function inferJdbcDialect(connection?: JdbcDialectConnection): DatabaseTy
|
||||
|
||||
export function effectiveDatabaseTypeForConnection(connection?: JdbcDialectConnection): DatabaseType | undefined {
|
||||
if (!connection) return undefined;
|
||||
if (connection.db_type === "gbase" && connection.driver_profile === "gbase8a") return "mysql";
|
||||
if (connection.db_type === "gbase" && connection.driver_profile === "gbase8s") return "informix";
|
||||
if (connection.db_type === "gbase" && isGbase8sProfile(connection.driver_profile)) return "informix";
|
||||
if (connection.db_type === "gbase") return "mysql";
|
||||
if (connection.db_type !== "jdbc") return connection.db_type;
|
||||
return inferJdbcDialect(connection) ?? "jdbc";
|
||||
}
|
||||
|
||||
export function tableStructureDatabaseTypeForConnection(connection?: JdbcDialectConnection): DatabaseType | undefined {
|
||||
if (!connection) return undefined;
|
||||
if (connection.db_type === "gbase" && connection.driver_profile === "gbase8a") return "gbase";
|
||||
if (connection.db_type === "gbase" && !isGbase8sProfile(connection.driver_profile)) return "gbase";
|
||||
return effectiveDatabaseTypeForConnection(connection);
|
||||
}
|
||||
|
||||
@@ -55,14 +55,13 @@ export function connectionUsesSchemaExecutionContext(connection?: Pick<Connectio
|
||||
}
|
||||
|
||||
export function connectionObjectTreeQuerySchema(connection: JdbcDialectConnection | undefined, database: string, schema?: string): string {
|
||||
if (connection?.db_type === "gbase" && connection.driver_profile === "gbase8a") return "";
|
||||
if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
|
||||
if (connectionUsesDatabaseObjectTreeMode(connection)) return "";
|
||||
return schema || database;
|
||||
}
|
||||
|
||||
export function connectionObjectTreeNodeSchema(connection: JdbcDialectConnection | undefined, database: string, schema?: string): string | undefined {
|
||||
if (connection?.db_type === "gbase" && connection.driver_profile === "gbase8a") return undefined;
|
||||
if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
|
||||
if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
|
||||
if (connectionUsesDatabaseObjectTreeMode(connection)) return undefined;
|
||||
if (schema) return schema;
|
||||
@@ -76,3 +75,7 @@ export function codeMirrorSqlDialect(dbType: DatabaseType | undefined): "mysql"
|
||||
if (dbType === "sqlserver") return "sqlserver";
|
||||
return "mysql";
|
||||
}
|
||||
|
||||
function isGbase8sProfile(driverProfile?: string): boolean {
|
||||
return driverProfile === "gbase8s";
|
||||
}
|
||||
Reference in new issue
Block a user