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。

1.1 KB
Raw Blame
import { connectionUsesConnectionRootSchemaMode, type JdbcDialectConnection } from "@/lib/database/jdbcDialect";

/**
 * Object-browser target for a row of the database/schema overview list.
 *
 * Engines that expose schemas directly below the connection (Oracle, Dameng,
 * OceanBase Oracle, and JDBC profiles inferred to them) list schemas in that
 * overview, so the clicked row must bind as both the database and the schema —
 * the same convention the sidebar uses when it locates a query context (see
 * ConnectionTree). Binding the row as a plain database instead opens the tab
 * under the connection default or the first schema, while the tab title keeps
 * showing the clicked name (#11795).
 *
 * Engines with a real database level (MySQL, PostgreSQL, ...) keep the row name
 * as the database and leave the schema to the browser's default selection.
 */
export function objectBrowserTargetForNamespaceRow(connection: JdbcDialectConnection | undefined, rowName: string): { database: string; schema?: string } {
  return connectionUsesConnectionRootSchemaMode(connection) ? { database: rowName, schema: rowName } : { database: rowName };
}