Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

869 B
Raw Blame
import type { ConnectionConfig } from "@/types/database";
import { connectionIsDorisFamilyCatalogCapable } from "@/lib/database/databaseFeatureSupport";
import { effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";

export function dataTabExecutionDatabase(connection: ConnectionConfig | undefined, tabDatabase: string, catalog?: string): string {
  if (!catalog?.trim()) return tabDatabase;

  const databaseType = effectiveDatabaseTypeForConnection(connection);
  const usesExternalCatalog = connectionIsDorisFamilyCatalogCapable(connection) || databaseType === "doris" || databaseType === "starrocks";
  if (!usesExternalCatalog) return tabDatabase;

  // External catalog namespaces qualify the SQL object name, but they are not
  // valid MySQL-protocol session databases. Keep the configured internal DB.
  return connection?.database ?? "";
}