mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-02 08:30:35 +00:00
feat: add Oracle database support
This commit is contained in:
@@ -87,6 +87,7 @@ function onDbTypeChange(val: string) {
|
||||
mongodb: { type: "mongodb", port: 27017, user: "" },
|
||||
clickhouse: { type: "clickhouse", port: 8123, user: "default" },
|
||||
sqlserver: { type: "sqlserver", port: 1433, user: "sa" },
|
||||
oracle: { type: "oracle", port: 1521, user: "system" },
|
||||
tidb: { type: "mysql", port: 4000, user: "root" },
|
||||
oceanbase: { type: "mysql", port: 2881, user: "root" },
|
||||
goldendb: { type: "mysql", port: 3306, user: "root" },
|
||||
@@ -110,6 +111,7 @@ function onDbTypeChange(val: string) {
|
||||
const iconTypeMap: Record<string, string> = {
|
||||
mysql: "mysql", postgres: "postgres", sqlite: "sqlite", redis: "redis",
|
||||
mongodb: "mongodb", duckdb: "duckdb", clickhouse: "clickhouse", sqlserver: "sqlserver",
|
||||
oracle: "oracle",
|
||||
mariadb: "mariadb", tidb: "tidb", oceanbase: "mysql", goldendb: "mysql",
|
||||
opengauss: "postgres", gaussdb: "postgres", kingbase: "postgres", vastbase: "postgres",
|
||||
};
|
||||
@@ -123,6 +125,7 @@ const dbOptions = [
|
||||
{ value: "duckdb", label: "DuckDB" },
|
||||
{ value: "clickhouse", label: "ClickHouse" },
|
||||
{ value: "sqlserver", label: "SQL Server" },
|
||||
{ value: "oracle", label: "Oracle" },
|
||||
{ value: "mariadb", label: "MariaDB" },
|
||||
];
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -144,7 +144,7 @@ async function openData() {
|
||||
if (!(node.type === "table" || node.type === "view") || !node.connectionId || !node.database) return;
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
const config = connectionStore.getConfig(node.connectionId);
|
||||
const qualifiedName = config?.db_type === "postgres" && node.schema
|
||||
const qualifiedName = (config?.db_type === "postgres" || config?.db_type === "oracle") && node.schema
|
||||
? `${quoteIdent(node.schema)}.${quoteIdent(node.label)}`
|
||||
: quoteIdent(node.label);
|
||||
const tabId = queryStore.createTab(node.connectionId, node.database, node.label, "data");
|
||||
@@ -153,7 +153,9 @@ async function openData() {
|
||||
const columns = await api.getColumns(node.connectionId, node.database, querySchema, node.label);
|
||||
const pks = columns.filter((c) => c.is_primary_key).map((c) => c.name);
|
||||
const order = pks.length ? ` ORDER BY ${pks.map((pk) => `${quoteIdent(pk)} ASC`).join(", ")}` : "";
|
||||
const sql = `SELECT * FROM ${qualifiedName}${order} LIMIT 100;`;
|
||||
const sql = config?.db_type === "oracle"
|
||||
? `SELECT * FROM ${qualifiedName}${order} FETCH FIRST 100 ROWS ONLY`
|
||||
: `SELECT * FROM ${qualifiedName}${order} LIMIT 100;`;
|
||||
queryStore.updateSql(tabId, sql);
|
||||
queryStore.setTableMeta(tabId, {
|
||||
schema: node.schema,
|
||||
|
||||
Reference in New Issue
Block a user