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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(firebird): add catalog object manager
zipg2982646deeb3
diff --git a/agents/common/src/main/java/com/dbx/agent/ObjectInfo.java b/agents/common/src/main/java/com/dbx/agent/ObjectInfo.javaindex 0604ca7dd7..0dc0f557ff 100644--- a/agents/common/src/main/java/com/dbx/agent/ObjectInfo.java+++ b/agents/common/src/main/java/com/dbx/agent/ObjectInfo.java@@ -8,6 +8,7 @@ public final class ObjectInfo {private String schema;private String comment;private Boolean valid;+ private String parent_name;public ObjectInfo() {this("", "", null, null, null);@@ -69,6 +70,14 @@ public final class ObjectInfo {this.valid = valid;}+ public String getParent_name() {+ return parent_name;+ }++ public void setParent_name(String parentName) {+ this.parent_name = parentName;+ }+@Overridepublic boolean equals(Object other) {if (this == other) return true;@@ -78,12 +87,13 @@ public final class ObjectInfo {&& Objects.equals(object_type, that.object_type)&& Objects.equals(schema, that.schema)&& Objects.equals(comment, that.comment)+ && Objects.equals(parent_name, that.parent_name)&& Objects.equals(valid, that.valid);}@Overridepublic int hashCode() {- return Objects.hash(name, object_type, schema, comment, valid);+ return Objects.hash(name, object_type, schema, comment, valid, parent_name);}@Overridediff --git a/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdAgent.java b/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdAgent.javaindex 8c508bbe7a..25cd64cb8d 100644--- a/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdAgent.java+++ b/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdAgent.java@@ -9,18 +9,79 @@ import com.dbx.agent.MultiSessionJsonRpcServer;import com.dbx.agent.ObjectInfo;import com.dbx.agent.ObjectSource;import com.dbx.agent.TableInfo;+import com.dbx.agent.TriggerInfo;import java.nio.charset.Charset;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.Types;import java.util.ArrayList;+import java.util.Iterator;+import java.util.Comparator;import java.util.List;import java.util.Locale;public final class FirebirdAgent extends ConfiguredJdbcAgent {+ private static final String COMMON_OBJECTS_SQL = """+ SELECT TRIM(RDB$GENERATOR_NAME) AS OBJECT_NAME, 'SEQUENCE' AS OBJECT_TYPE, NULL AS OBJECT_COMMENT+ FROM RDB$GENERATORS WHERE COALESCE(RDB$SYSTEM_FLAG, 0) = 0+ UNION ALL+ SELECT TRIM(RDB$TRIGGER_NAME), 'TRIGGER', TRIM(RDB$RELATION_NAME)+ FROM RDB$TRIGGERS WHERE COALESCE(RDB$SYSTEM_FLAG, 0) = 0+ UNION ALL+ SELECT TRIM(RDB$INDEX_NAME), 'INDEX', TRIM(RDB$RELATION_NAME)+ FROM RDB$INDICES WHERE COALESCE(RDB$SYSTEM_FLAG, 0) = 0+ """.stripIndent().trim();++ static String catalogObjectsSql(int majorVersion) {+ if (majorVersion < 3) {+ return COMMON_OBJECTS_SQL + " UNION ALL SELECT TRIM(RDB$FUNCTION_NAME), 'FUNCTION_UDF', TRIM(RDB$MODULE_NAME) FROM RDB$FUNCTIONS WHERE COALESCE(RDB$SYSTEM_FLAG,0)=0";+ }+ return COMMON_OBJECTS_SQL + " UNION ALL " + """+ SELECT TRIM(RDB$PACKAGE_NAME), 'PACKAGE', NULL+ FROM RDB$PACKAGES WHERE COALESCE(RDB$SYSTEM_FLAG, 0) = 0+ UNION ALL+ SELECT CASE WHEN RDB$PACKAGE_NAME IS NULL THEN TRIM(RDB$FUNCTION_NAME)+ ELSE TRIM(RDB$PACKAGE_NAME) || '.' || TRIM(RDB$FUNCTION_NAME) END,+ CASE WHEN NULLIF(TRIM(RDB$MODULE_NAME),'') IS NULL AND NULLIF(TRIM(RDB$ENGINE_NAME),'') IS NULL+ THEN 'FUNCTION_INTERNAL' ELSE 'FUNCTION_UDF' END,+ COALESCE(NULLIF(TRIM(RDB$MODULE_NAME), ''), NULLIF(TRIM(RDB$ENGINE_NAME), ''))+ FROM RDB$FUNCTIONS WHERE COALESCE(RDB$SYSTEM_FLAG, 0) = 0+ """.stripIndent().trim();+ }private Charset dataCharset;+ @Override+ public List<TriggerInfo> listTriggers(String schema, String table) {+ return unchecked(() -> {+ List<TriggerInfo> triggers = new ArrayList<>();+ try (PreparedStatement statement = requireConnection().prepareStatement(+ "SELECT TRIM(RDB$TRIGGER_NAME), RDB$TRIGGER_TYPE FROM RDB$TRIGGERS WHERE RDB$RELATION_NAME = ? AND COALESCE(RDB$SYSTEM_FLAG,0)=0 ORDER BY RDB$TRIGGER_NAME")) {+ statement.setString(1, table);+ try (ResultSet result = statement.executeQuery()) {+ while (result.next()) {+ int type = result.getInt(2);+ triggers.add(new TriggerInfo(result.getString(1), triggerEvent(type), type % 2 == 1 ? "BEFORE" : "AFTER"));+ }+ }+ }+ return triggers;+ });+ }++ static String triggerEvent(int type) {+ return switch (type) {+ case 1, 2 -> "INSERT";+ case 3, 4 -> "UPDATE";+ case 5, 6 -> "DELETE";+ case 17, 18 -> "INSERT OR UPDATE";+ case 25, 26 -> "INSERT OR DELETE";+ case 27, 28 -> "UPDATE OR DELETE";+ case 113, 114 -> "INSERT OR UPDATE OR DELETE";+ default -> Integer.toString(type);+ };+ }+@Overrideprotected String buildJdbcUrl(ConnectParams params) {String url = super.buildJdbcUrl(params);@@ -75,9 +136,44 @@ public final class FirebirdAgent extends ConfiguredJdbcAgent {@Overridepublic List<ObjectInfo> listObjects(String schema, MetadataListConstraints constraints) {- List<ObjectInfo> objects = super.listObjects(schema, constraints);+ List<ObjectInfo> objects = new ArrayList<>(super.listObjects(schema, MetadataListConstraints.NONE));+ // JDBC metadata flattens all Firebird functions into FUNCTION and does+ // not expose generators, packages, database triggers, or indexes. Use+ // the Firebird catalogs so the object browser can keep those categories+ // distinct without changing the table-scoped metadata APIs.+ for (Iterator<ObjectInfo> iterator = objects.iterator(); iterator.hasNext();) {+ ObjectInfo object = iterator.next();+ if ("FUNCTION".equalsIgnoreCase(object.getObject_type())) iterator.remove();+ }+ unchecked(() -> {+ try (PreparedStatement statement = requireConnection().prepareStatement(catalogObjectsSql(requireConnection().getMetaData().getDatabaseMajorVersion()));+ ResultSet resultSet = statement.executeQuery()) {+ while (resultSet.next()) {+ String name = trimToNull(resultSet.getString("OBJECT_NAME"));+ String type = trimToNull(resultSet.getString("OBJECT_TYPE"));+ if (name == null || type == null) continue;+ String comment = decodeLegacyText(trimToNull(resultSet.getString("OBJECT_COMMENT")));+ ObjectInfo object = new ObjectInfo(name, type, schema, comment);+ if ("INDEX".equals(type) || "TRIGGER".equals(type)) {+ object.setParent_name(comment);+ object.setComment(null);+ }+ objects.add(object);+ }+ }+ return null;+ });for (ObjectInfo object : objects) object.setComment(decodeLegacyText(object.getComment()));- return objects;+ MetadataListConstraints normalized = MetadataListConstraints.orNone(constraints);+ // Preserve the existing FUNCTION metadata request used by older clients+ // while exposing the two precise categories to the new object browser.+ if (normalized.getObjectTypes() != null && normalized.getObjectTypes().contains("FUNCTION")) {+ for (ObjectInfo object : objects) {+ if (object.getObject_type().startsWith("FUNCTION_")) object.setObject_type("FUNCTION");+ }+ }+ objects.sort(Comparator.comparing(ObjectInfo::getName).thenComparing(ObjectInfo::getObject_type));+ return normalized.filterObjects(objects);}static final String PROCEDURE_SOURCE_SQL = """SELECT@@ -137,6 +233,10 @@ public final class FirebirdAgent extends ConfiguredJdbcAgent {@Overridepublic ObjectSource getObjectSource(String schema, String name, String objectType) {+ String requestedType = normalizeObjectSourceType(objectType);+ if (!"PROCEDURE".equals(requestedType)) {+ return unchecked(() -> FirebirdObjectSource.read(requireConnection(), schema, name, requestedType, this::decodeLegacyText));+ }String normalizedType = normalizeObjectSourceType(objectType);return unchecked(() -> {String body = null;@@ -191,7 +291,7 @@ public final class FirebirdAgent extends ConfiguredJdbcAgent {throw new IllegalArgumentException("Unsupported object type: null");}String normalized = objectType.trim().toUpperCase(Locale.ROOT);- if (!"PROCEDURE".equals(normalized)) {+ if (!List.of("PROCEDURE", "FUNCTION", "TRIGGER", "SEQUENCE", "PACKAGE", "PACKAGE_BODY", "VIEW").contains(normalized)) {throw new IllegalArgumentException("Unsupported object type: " + objectType);}return normalized;diff --git a/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdObjectSource.java b/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdObjectSource.javanew file mode 100644index 0000000000..94e4bffeb3--- /dev/null+++ b/agents/drivers/firebird/src/main/java/com/dbx/agent/firebird/FirebirdObjectSource.java@@ -0,0 +1,73 @@+package com.dbx.agent.firebird;++import com.dbx.agent.ObjectSource;+import java.sql.Connection;+import java.sql.PreparedStatement;+import java.sql.ResultSet;+import java.sql.SQLException;+import java.util.function.UnaryOperator;++/** Read-only catalog source: stored routine bodies are never advertised as executable DDL. */+final class FirebirdObjectSource {+ static ObjectSource read(Connection connection, String schema, String name, String type,+ UnaryOperator<String> decode) throws SQLException {+ String sql = switch (type) {+ case "FUNCTION" -> "SELECT RDB$FUNCTION_SOURCE, RDB$MODULE_NAME, RDB$ENTRYPOINT, RDB$ENGINE_NAME FROM RDB$FUNCTIONS WHERE CASE WHEN RDB$PACKAGE_NAME IS NULL THEN TRIM(RDB$FUNCTION_NAME) ELSE TRIM(RDB$PACKAGE_NAME) || '.' || TRIM(RDB$FUNCTION_NAME) END = ?";+ case "TRIGGER" -> "SELECT RDB$TRIGGER_SOURCE, RDB$RELATION_NAME, RDB$TRIGGER_TYPE, RDB$TRIGGER_SEQUENCE, RDB$TRIGGER_INACTIVE FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME = ?";+ case "PACKAGE", "PACKAGE_BODY" -> "SELECT RDB$PACKAGE_HEADER_SOURCE, RDB$PACKAGE_BODY_SOURCE FROM RDB$PACKAGES WHERE RDB$PACKAGE_NAME = ?";+ case "SEQUENCE" -> "SELECT RDB$GENERATOR_NAME, RDB$INITIAL_VALUE, RDB$GENERATOR_INCREMENT FROM RDB$GENERATORS WHERE RDB$GENERATOR_NAME = ?";+ case "VIEW" -> "SELECT RDB$VIEW_SOURCE FROM RDB$RELATIONS WHERE RDB$RELATION_NAME = ? AND RDB$VIEW_BLR IS NOT NULL";+ default -> throw new IllegalArgumentException("Unsupported Firebird object type: " + type);+ };+ boolean legacy = connection.getMetaData().getDatabaseMajorVersion() < 3;+ if (legacy && "FUNCTION".equals(type)) {+ sql = "SELECT CAST(NULL AS VARCHAR(1)), RDB$MODULE_NAME, RDB$ENTRYPOINT, CAST(NULL AS VARCHAR(1)) FROM RDB$FUNCTIONS WHERE RDB$FUNCTION_NAME = ?";+ } else if (legacy && "SEQUENCE".equals(type)) {+ sql = "SELECT RDB$GENERATOR_NAME, 0, 1 FROM RDB$GENERATORS WHERE RDB$GENERATOR_NAME = ?";+ }+ String source = "";+ try (PreparedStatement statement = connection.prepareStatement(sql)) {+ statement.setString(1, name);+ try (ResultSet result = statement.executeQuery()) {+ if (result.next()) {+ String quoted = "\"" + name.replace("\"", "\"\"") + "\"";+ source = switch (type) {+ case "FUNCTION" -> functionSource(result, decode);+ case "TRIGGER" -> "-- Trigger: " + name + "\n-- Relation: " + result.getString(2)+ + "\n-- Type: " + result.getInt(3) + ", position: " + result.getInt(4)+ + ", inactive: " + result.getInt(5) + "\n" + text(decode.apply(result.getString(1)));+ case "PACKAGE", "PACKAGE_BODY" -> packageSource(result, quoted, decode);+ case "SEQUENCE" -> legacy ? "-- Generator: " + quoted+ : "CREATE SEQUENCE " + quoted + " START WITH " + result.getLong(2)+ + " INCREMENT BY " + result.getLong(3) + ";";+ case "VIEW" -> "-- Stored view query\n" + text(decode.apply(result.getString(1)));+ default -> "";+ };+ }+ }+ }+ return new ObjectSource(name, type, schema, source, false);+ }++ private static String functionSource(ResultSet result, UnaryOperator<String> decode) throws SQLException {+ String body = decode.apply(result.getString(1));+ if (body != null && !body.isBlank()) return "-- Stored function body\n" + body;+ if (text(result.getString(2)).isBlank() && text(result.getString(4)).isBlank()) {+ return "-- No stored function body is available.";+ }+ return "-- External function\n-- Module: " + text(result.getString(2))+ + "\n-- Entry point: " + text(result.getString(3))+ + "\n-- Engine: " + text(result.getString(4));+ }++ private static String packageSource(ResultSet result, String name, UnaryOperator<String> decode) throws SQLException {+ String header = decode.apply(result.getString(1));+ String body = decode.apply(result.getString(2));+ return "CREATE OR ALTER PACKAGE " + name + " AS\n" + text(header)+ + (body == null ? "" : "\n\nCREATE OR ALTER PACKAGE BODY " + name + " AS\n" + body);+ }++ private static String text(String value) {+ return value == null ? "" : value.stripTrailing();+ }+}diff --git a/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdAgentTest.java b/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdAgentTest.javaindex f45e0c861c..0a23172af5 100644--- a/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdAgentTest.java+++ b/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdAgentTest.java@@ -333,10 +333,10 @@ class FirebirdAgentTest {IllegalArgumentException error = Assertions.assertThrows(IllegalArgumentException.class,- () -> agent.getObjectSource(null, "P_6141", "VIEW")+ () -> agent.getObjectSource(null, "P_6141", "UNKNOWN"));- Assertions.assertEquals("Unsupported object type: VIEW", error.getMessage());+ Assertions.assertEquals("Unsupported object type: UNKNOWN", error.getMessage());}@SafeVarargsdiff --git a/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdObjectSourceTest.java b/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdObjectSourceTest.javanew file mode 100644index 0000000000..47466d7d1a--- /dev/null+++ b/agents/drivers/firebird/src/test/java/com/dbx/agent/firebird/FirebirdObjectSourceTest.java@@ -0,0 +1,78 @@+package com.dbx.agent.firebird;++import com.dbx.agent.ObjectSource;+import java.lang.reflect.Proxy;+import java.sql.Connection;+import java.sql.PreparedStatement;+import java.sql.ResultSet;+import java.util.ArrayList;+import java.util.List;+import org.junit.jupiter.api.Test;+import static org.junit.jupiter.api.Assertions.*;++class FirebirdObjectSourceTest {+ @Test+ void generatorSourceNeverReadsOrIncrementsCurrentValue() throws Exception {+ List<String> calls = new ArrayList<>();+ ObjectSource source = FirebirdObjectSource.read(connection(calls, "G\"ID", 10L, 5L), "", "G\"ID", "SEQUENCE", value -> value);+ assertEquals("CREATE SEQUENCE \"G\"\"ID\" START WITH 10 INCREMENT BY 5;", source.getSource());+ assertFalse(source.isEditable());+ assertEquals("G\"ID", calls.get(1));+ assertFalse(calls.get(0).contains("GEN_ID"));+ }++ @Test+ void externalFunctionsShowModuleEntrypointAndEngineWithoutCallingUdf() throws Exception {+ List<String> calls = new ArrayList<>();+ ObjectSource source = FirebirdObjectSource.read(connection(calls, null, "FreeAdhocUDF", "f_abs", null), "", "F_ABS", "FUNCTION", value -> value);+ assertTrue(source.getSource().contains("Module: FreeAdhocUDF"));+ assertTrue(source.getSource().contains("Entry point: f_abs"));+ assertTrue(calls.get(0).startsWith("SELECT "));+ assertFalse(source.isEditable());+ }++ @Test+ void packagedFunctionsUseQualifiedCatalogIdentityAndDecodeOnlyBody() throws Exception {+ List<String> calls = new ArrayList<>();+ ObjectSource source = FirebirdObjectSource.read(connection(calls, "²Ý¸å", null, null, null), "", "MYUDR2.FN", "FUNCTION",+ value -> LegacyTextDecoder.decode(value, java.nio.charset.Charset.forName("GBK")));+ assertEquals("MYUDR2.FN", calls.get(1));+ assertTrue(calls.get(0).contains("RDB$PACKAGE_NAME"));+ assertTrue(source.getSource().contains("草稿"));+ }++ private static Connection connection(List<String> calls, Object... values) {+ ResultSet result = (ResultSet) Proxy.newProxyInstance(ResultSet.class.getClassLoader(), new Class<?>[] {ResultSet.class},+ new java.lang.reflect.InvocationHandler() {+ boolean first = true;+ public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) {+ return switch (method.getName()) {+ case "next" -> { boolean value = first; first = false; yield value; }+ case "getString" -> { Object value = values[(Integer) args[0] - 1]; yield value == null ? null : value.toString(); }+ case "getLong" -> ((Number) values[(Integer) args[0] - 1]).longValue();+ case "close" -> null;+ default -> throw new UnsupportedOperationException(method.getName());+ };+ }+ });+ PreparedStatement statement = (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class<?>[] {PreparedStatement.class},+ (proxy, method, args) -> switch (method.getName()) {+ case "setString" -> { calls.add((String) args[1]); yield null; }+ case "executeQuery" -> result;+ case "close" -> null;+ default -> throw new UnsupportedOperationException(method.getName());+ });+ return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class<?>[] {Connection.class},+ (proxy, method, args) -> {+ if (method.getName().equals("getMetaData")) {+ return Proxy.newProxyInstance(java.sql.DatabaseMetaData.class.getClassLoader(), new Class<?>[] {java.sql.DatabaseMetaData.class},+ (metadata, operation, arguments) -> {+ if (operation.getName().equals("getDatabaseMajorVersion")) return 5;+ throw new UnsupportedOperationException(operation.getName());+ });+ }+ if (method.getName().equals("prepareStatement")) { calls.add((String) args[0]); return statement; }+ throw new UnsupportedOperationException(method.getName());+ });+ }+}diff --git a/agents/metadata-constraint-coverage.tsv b/agents/metadata-constraint-coverage.tsvindex e807988651..8790b4fd12 100644--- a/agents/metadata-constraint-coverage.tsv+++ b/agents/metadata-constraint-coverage.tsv@@ -6,7 +6,7 @@ cassandra-go shared-fallback native-go Uses cassandra-gocql-driver schema metadadameng native-pushdown java-sql Uses ALL_OBJECTS with type, filter, stable order, and LIMIT/OFFSET with legacy fallback.databend native-pushdown java-sql Uses system procedures for routine pushdown and shared table metadata constraints for table-like objects.db2 native-pushdown java-sql Uses SYSCAT metadata with type, filter, stable order, and OFFSET/FETCH.-firebird shared-fallback java-jdbc-metadata Delegates constrained listings to shared JDBC metadata and only applies explicitly configured legacy text decoding to comments.+firebird native-pushdown java-sql Lists objects natively from RDB$ system tables; constrained listings only apply explicitly configured legacy text decoding to comments.gbase8a native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.gbase8s native-pushdown java-sql Uses systables with type, filter, stable order, and SKIP/FIRST.goldendb native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.diff --git a/apps/desktop/src/components/objects/FirebirdObjectManager.vue b/apps/desktop/src/components/objects/FirebirdObjectManager.vuenew file mode 100644index 0000000000..578ecc2539--- /dev/null+++ b/apps/desktop/src/components/objects/FirebirdObjectManager.vue@@ -0,0 +1,152 @@+<script setup lang="ts">+import { computed, ref, watch } from "vue";+import { useI18n } from "vue-i18n";+import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import * as api from "@/lib/backend/api";+import { copyToClipboard } from "@/lib/common/clipboard";+import { translateBackendError } from "@/i18n/backend-errors";+import type { ObjectInfo, ObjectSourceKind } from "@/types/database";++const props = defineProps<{ open: boolean; connectionId: string; database: string }>();+const emit = defineEmits<{ "update:open": [value: boolean] }>();+const { t } = useI18n();+const rows = ref<ObjectInfo[]>([]);+const category = ref("SEQUENCE");+const search = ref("");+const loading = ref(false);+const error = ref("");+const selected = ref<ObjectInfo | null>(null);+const detail = ref("");+const detailLoading = ref(false);+let loadEpoch = 0;+let detailEpoch = 0;+const categories = [+ ["SEQUENCE", "tree.firebirdGenerators"],+ ["PACKAGE", "tree.packages"],+ ["TRIGGER", "tree.triggers"],+ ["INDEX", "tree.indexes"],+ ["FUNCTION_INTERNAL", "tree.internalFunctions"],+ ["FUNCTION_UDF", "tree.udfFunctions"],+] as const;+const visible = computed(() => {+ const query = search.value.trim().toLocaleLowerCase();+ return rows.value.filter((row) => row.object_type === category.value && (!query || [row.name, row.comment, row.parent_name].some((value) => value?.toLocaleLowerCase().includes(query))));+});+function clearDetail() {+ detailEpoch++;+ selected.value = null;+ detail.value = "";+ detailLoading.value = false;+}+async function refresh() {+ const epoch = ++loadEpoch;+ loading.value = true;+ error.value = "";+ clearDetail();+ try {+ const objects = await api.listObjects(+ props.connectionId,+ props.database,+ "",+ categories.map(([type]) => type),+ );+ if (epoch === loadEpoch) rows.value = objects;+ } catch (cause) {+ if (epoch === loadEpoch) error.value = translateBackendError(t, cause);+ } finally {+ if (epoch === loadEpoch) loading.value = false;+ }+}+async function showDetail(row: ObjectInfo) {+ const epoch = ++detailEpoch;+ selected.value = row;+ detail.value = "";+ detailLoading.value = true;+ error.value = "";+ try {+ let text: string;+ if (row.object_type === "INDEX") {+ const literal = "'" + row.name.replaceAll("'", "''") + "'";+ const result = await api.executeQuery(+ props.connectionId,+ props.database,+ `SELECT TRIM(I.RDB$RELATION_NAME) AS TABLE_NAME, I.RDB$UNIQUE_FLAG AS UNIQUE_FLAG, I.RDB$INDEX_INACTIVE AS INACTIVE, I.RDB$INDEX_TYPE AS DESCENDING_FLAG, I.RDB$EXPRESSION_SOURCE AS EXPRESSION_SOURCE, TRIM(S.RDB$FIELD_NAME) AS FIELD_NAME, S.RDB$FIELD_POSITION AS FIELD_POSITION FROM RDB$INDICES I LEFT JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME WHERE I.RDB$INDEX_NAME=${literal} ORDER BY S.RDB$FIELD_POSITION`,+ );+ text = result.rows.map((values) => result.columns.map((column, index) => `${column}: ${values[index] ?? "NULL"}`).join("\n")).join("\n\n");+ } else {+ const type: ObjectSourceKind = row.object_type.startsWith("FUNCTION_") ? "FUNCTION" : (row.object_type as ObjectSourceKind);+ const source = await api.getObjectSource(props.connectionId, props.database, "", row.name, type);+ text = source.source;+ }+ if (epoch === detailEpoch) detail.value = text || t("objects.empty");+ } catch (cause) {+ if (epoch === detailEpoch) error.value = translateBackendError(t, cause);+ } finally {+ if (epoch === detailEpoch) detailLoading.value = false;+ }+}+watch(category, clearDetail);+watch(+ () => [props.open, props.connectionId, props.database] as const,+ ([open]) => {+ if (open) void refresh();+ else {+ loadEpoch++;+ clearDetail();+ loading.value = false;+ }+ },+ { immediate: true },+);+</script>++<template>+ <Dialog :open="open" @update:open="emit('update:open', $event)">+ <DialogContent class="flex h-[80vh] max-w-6xl flex-col gap-3">+ <DialogHeader+ ><DialogTitle>{{ t("tree.firebirdObjectManager") }}</DialogTitle></DialogHeader+ >+ <div class="flex flex-wrap items-center gap-2">+ <select v-model="category" :aria-label="t('objects.type')" class="h-9 rounded border bg-background px-2 text-sm">+ <option v-for="[type, label] in categories" :key="type" :value="type">{{ t(label) }} ({{ rows.filter((row) => row.object_type === type).length }})</option>+ </select>+ <Input v-model="search" class="min-w-40 flex-1" :placeholder="t('objects.search')" />+ <Button variant="outline" :disabled="loading" @click="refresh">{{ t("grid.refresh") }}</Button>+ </div>+ <p v-if="error" role="alert" class="text-sm text-destructive">{{ error }}</p>+ <div v-if="loading" role="status">{{ t("common.loading") }}</div>+ <div v-else class="flex min-h-0 flex-1 gap-3 overflow-hidden">+ <div class="min-w-0 flex-1 overflow-auto rounded border">+ <table class="w-full text-left text-sm">+ <thead class="sticky top-0 bg-muted">+ <tr>+ <th class="p-2">{{ t("objects.name") }}</th>+ <th class="p-2">{{ t("tree.tables") }} / {{ t("objects.comment") }}</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="row in visible" :key="`${row.object_type}:${row.name}`" :class="selected === row ? 'bg-accent' : ''">+ <td class="p-2">+ <button class="text-left hover:underline" @click="showDetail(row)">{{ row.name }}</button>+ </td>+ <td class="p-2 text-muted-foreground">{{ row.parent_name || row.comment }}</td>+ </tr>+ </tbody>+ </table>+ <p v-if="!visible.length" class="p-4 text-sm text-muted-foreground">{{ t("objects.empty") }}</p>+ </div>+ <div v-if="selected" class="flex w-1/2 min-w-0 flex-col rounded border">+ <div class="flex items-center justify-between gap-2 border-b p-2">+ <span class="truncate">{{ selected.name }}</span+ ><Button variant="outline" :disabled="detailLoading || !detail" @click="copyToClipboard(detail)">{{ t("common.copy") }}</Button>+ </div>+ <p v-if="detailLoading" class="p-2">{{ t("common.loading") }}</p>+ <pre v-else class="min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-3 text-xs">{{ detail }}</pre>+ </div>+ </div>+ <p class="text-xs text-muted-foreground">{{ t("tree.firebirdReadOnlyHint") }}</p>+ </DialogContent>+ </Dialog>+</template>diff --git a/apps/desktop/src/components/objects/ObjectBrowser.vue b/apps/desktop/src/components/objects/ObjectBrowser.vueindex 5f6f7f3ad8..15583c792b 100644--- a/apps/desktop/src/components/objects/ObjectBrowser.vue+++ b/apps/desktop/src/components/objects/ObjectBrowser.vue@@ -1,6 +1,7 @@<script setup lang="ts">import { applyDdlStoragePreference } from "@/lib/sql/ddlStorage";import DatabaseActionsMenu from "@/components/objects/DatabaseActionsMenu.vue";+import FirebirdObjectManager from "@/components/objects/FirebirdObjectManager.vue";import { useDatabaseBrowserMutation } from "@/lib/database/databaseBrowserActions";import DdlStorageToggle from "@/components/objects/DdlStorageToggle.vue";@@ -222,6 +223,7 @@ const refreshTooltip = computed(() => {return shortcut ? `${t("grid.refresh")} (${shortcut})` : t("grid.refresh");});+const firebirdManagerOpen = ref(false);const schemas = ref<string[]>([]);const selectedSchema = ref<string | undefined>(props.schema);const rows = ref<ObjectBrowserRow[]>([]);@@ -3346,7 +3348,7 @@ async function loadObjects(options?: { allowCached?: boolean; preserveExistingRoasync function loadSqlObjectBrowserRows(request: ObjectBrowserRowsLoadHandle) {const objects: ObjectInfo[] = await api.listObjects(request.scope.connectionId, request.scope.database, request.scope.schema, undefined, undefined, undefined, undefined, request.scope.catalog);return buildObjectBrowserRows({- objects,+ objects: objects.filter((object) => object.object_type !== "INDEX"),database: request.scope.database,fallbackSchema: request.scope.schema,rowSchema: connectionObjectTreeNodeSchema(props.connection, props.database, selectedSchema.value),@@ -3831,8 +3833,10 @@ function getObjectBrowserMenuItems(item: ObjectBrowserRow): ContextMenuItem[] {</script><template>+ <FirebirdObjectManager v-if="effectiveDatabaseType === 'firebird'" v-model:open="firebirdManagerOpen" :connection-id="connection.id" :database="database" /><div ref="rootRef" data-object-browser-root class="flex h-full min-h-0 min-w-0 flex-col bg-background outline-none" tabindex="0" @keydown="onObjectBrowserKeydown"><div v-if="!isEventEditor" ref="toolbarRef" class="flex h-10 shrink-0 items-center gap-2 overflow-hidden border-b px-3">+ <Button v-if="effectiveDatabaseType === 'firebird'" variant="outline" size="sm" @click="firebirdManagerOpen = true">{{ t("tree.firebirdObjectManager") }}</Button><div class="flex min-w-12 items-center gap-2"><span class="inline-flex max-w-[14rem] min-w-0 items-center rounded border border-border bg-muted/50 px-2 py-0.5 text-xs font-medium truncate" :title="selectedSchema || props.database">{{ selectedSchema || props.database }}diff --git a/apps/desktop/src/components/objects/__tests__/FirebirdObjectManager.spec.ts b/apps/desktop/src/components/objects/__tests__/FirebirdObjectManager.spec.tsnew file mode 100644index 0000000000..0dfffca706--- /dev/null+++ b/apps/desktop/src/components/objects/__tests__/FirebirdObjectManager.spec.ts@@ -0,0 +1,77 @@+// @vitest-environment happy-dom+import { createApp, nextTick } from "vue";+import { afterEach, describe, expect, it, vi } from "vitest";+import i18n from "@/i18n";+import FirebirdObjectManager from "../FirebirdObjectManager.vue";+import * as api from "@/lib/backend/api";++vi.mock("@/lib/backend/api", () => ({ listObjects: vi.fn(), getObjectSource: vi.fn(), executeQuery: vi.fn() }));+vi.mock("@/components/ui/dialog", async () => {+ const { defineComponent, h } = await import("vue");+ const passthrough = defineComponent({+ setup:+ (_props, { slots }) =>+ () =>+ h("section", slots.default?.()),+ });+ return { Dialog: passthrough, DialogContent: passthrough, DialogHeader: passthrough, DialogTitle: passthrough };+});+const apps: ReturnType<typeof createApp>[] = [];+async function mount() {+ i18n.global.locale.value = "en";+ const container = document.createElement("div");+ document.body.append(container);+ const app = createApp(FirebirdObjectManager, { open: true, connectionId: "fb", database: "db" });+ app.use(i18n);+ apps.push(app);+ app.mount(container);+ await vi.waitFor(() => expect(api.listObjects).toHaveBeenCalled());+ await nextTick();+}+afterEach(() => {+ apps.splice(0).forEach((app) => app.unmount());+ document.body.innerHTML = "";+ vi.clearAllMocks();+});++describe("Firebird object manager", () => {+ it("filters categories and names and reads sources without executing them", async () => {+ vi.mocked(api.listObjects).mockResolvedValue([+ { name: "GEN_ORDER", object_type: "SEQUENCE" },+ { name: "F_ABS", object_type: "FUNCTION_UDF", comment: "FreeAdhocUDF" },+ { name: "F_GETNO", object_type: "FUNCTION_INTERNAL" },+ ]);+ vi.mocked(api.getObjectSource).mockResolvedValue({ name: "F_ABS", object_type: "FUNCTION", source: "-- Module: FreeAdhocUDF", editable: false });+ await mount();+ await vi.waitFor(() => expect(document.body.textContent).toContain("GEN_ORDER"));+ const select = document.querySelector("select")!;+ select.value = "FUNCTION_UDF";+ select.dispatchEvent(new Event("change"));+ await nextTick();+ const input = document.querySelector("input")!;+ input.value = "FreeAdhoc";+ input.dispatchEvent(new Event("input"));+ await nextTick();+ expect(document.querySelector("tbody")?.textContent).toContain("F_ABS");+ expect(document.querySelector("tbody")?.textContent).not.toContain("F_GETNO");+ [...document.querySelectorAll("button")].find((button) => button.textContent === "F_ABS")!.click();+ await vi.waitFor(() => expect(document.querySelector("pre")?.textContent).toContain("FreeAdhocUDF"));+ expect(api.getObjectSource).toHaveBeenCalledWith("fb", "db", "", "F_ABS", "FUNCTION");+ expect(api.executeQuery).not.toHaveBeenCalled();+ });+ it("escapes quoted index names and requests only read-only catalog details", async () => {+ vi.mocked(api.listObjects).mockResolvedValue([{ name: "IX'O", object_type: "INDEX", parent_name: "ORDERS" }]);+ vi.mocked(api.executeQuery).mockResolvedValue({ columns: ["TABLE_NAME"], rows: [["ORDERS"]], column_types: ["VARCHAR"], affected_rows: 0, execution_time_ms: 1 });+ await mount();+ await vi.waitFor(() => expect(document.querySelector("option[value=INDEX]")?.textContent).toContain("(1)"));+ const select = document.querySelector("select")!;+ select.value = "INDEX";+ select.dispatchEvent(new Event("change"));+ await nextTick();+ [...document.querySelectorAll("button")].find((button) => button.textContent === "IX'O")!.click();+ await vi.waitFor(() => expect(api.executeQuery).toHaveBeenCalled());+ const sql = vi.mocked(api.executeQuery).mock.calls[0][2];+ expect(sql).toContain("WHERE I.RDB$INDEX_NAME='IX''O'");+ expect(sql).toMatch(/^SELECT /);+ });+});diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vueindex 79ac8a7bd6..a5dafc34e4 100644--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue@@ -355,9 +355,12 @@ const searchableObjectGroupTypes = new Set<TreeNodeType>(["group-materialized-views","group-procedures","group-functions",+ "group-internal-functions",+ "group-udf-functions","group-triggers","group-events","group-sequences",+ "group-database-indexes","group-synonyms","group-jobs","group-packages",diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vueindex b8cffccd7c..24ed9a5845 100644--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue@@ -798,6 +798,8 @@ const groupTypes: Set<TreeNodeType> = new Set(["group-materialized-views","group-procedures","group-functions",+ "group-internal-functions",+ "group-udf-functions","group-sequences","group-synonyms","group-jobs",diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vueindex 1cbe06fc93..c02dfbafce 100644--- a/apps/desktop/src/components/sidebar/TreeItem.vue+++ b/apps/desktop/src/components/sidebar/TreeItem.vue@@ -401,6 +401,10 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {return { icon: ScrollText, colorClass: "text-blue-500" };case "group-functions":return { icon: Braces, colorClass: "text-amber-500" };+ case "group-internal-functions":+ return { icon: Braces, colorClass: "text-emerald-500" };+ case "group-udf-functions":+ return { icon: Braces, colorClass: "text-orange-500" };case "group-sequences":return { icon: ListTree, colorClass: "text-emerald-500" };case "group-synonyms":@@ -411,6 +415,8 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {return { icon: Package, colorClass: "text-cyan-500" };case "group-types":return { icon: Braces, colorClass: "text-violet-500" };+ case "group-database-indexes":+ return { icon: Key, colorClass: "text-amber-400" };case "group-partitions":return { icon: node.isExpanded ? FolderOpen : FolderClosed, colorClass: "text-green-400" };case "group-extensions":@@ -1751,6 +1757,8 @@ function onKeydown(event: KeyboardEvent) {node.type === 'group-materialized-views' ||node.type === 'group-procedures' ||node.type === 'group-functions' ||+ node.type === 'group-internal-functions' ||+ node.type === 'group-udf-functions' ||node.type === 'group-columns' ||node.type === 'group-indexes' ||node.type === 'group-fkeys' ||diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.tsindex dc631ca8eb..9c3c4c1b6b 100644--- a/apps/desktop/src/i18n/locales/az.ts+++ b/apps/desktop/src/i18n/locales/az.ts@@ -3945,6 +3945,11 @@ export default withEnglishFallback({attributes: "Atributlar",methods: "Metodlar",indexes: "İndekslər",+ firebirdObjectManager: "Firebird obyekt idarəetməsi",+ firebirdGenerators: "Generatorlar",+ firebirdReadOnlyHint: "Metadata və saxlanmış mənbə yalnız oxumaq üçündür. Baxış generator dəyərlərini artırmır.",+ internalFunctions: "Daxili funksiyalar (PSQL)",+ udfFunctions: "UDF / xarici funksiyalar",foreignKeys: "Xarici açarlar",triggers: "Tətikləyicilər",events: "Hadisələr",diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 5136aba37f..7901890c27 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -4474,6 +4474,11 @@ export default {attributes: "Attributes",methods: "Methods",indexes: "Indexes",+ firebirdObjectManager: "Firebird object manager",+ firebirdGenerators: "Generators",+ firebirdReadOnlyHint: "Read-only metadata and stored source. Viewing generators does not advance their values.",+ internalFunctions: "Internal functions (PSQL)",+ udfFunctions: "UDF / external functions",foreignKeys: "Foreign Keys",triggers: "Triggers",events: "Events",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 129b838bfc..2e5b726acd 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -4377,6 +4377,11 @@ export default withEnglishFallback({attributes: "Atributos",methods: "Métodos",indexes: "Índices",+ firebirdObjectManager: "Gestor de objetos Firebird",+ firebirdGenerators: "Generadores",+ firebirdReadOnlyHint: "Metadatos y código guardado de solo lectura. Ver generadores no incrementa sus valores.",+ internalFunctions: "Funciones internas (PSQL)",+ udfFunctions: "UDF / funciones externas",foreignKeys: "Claves foráneas",triggers: "Disparadores",events: "Eventos",diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.tsindex 7372aeb27e..81c0ba02b2 100644--- a/apps/desktop/src/i18n/locales/id.ts+++ b/apps/desktop/src/i18n/locales/id.ts@@ -4268,6 +4268,11 @@ export default withEnglishFallback({attributes: "Atribut",methods: "Metode",indexes: "Indeks",+ firebirdObjectManager: "Pengelola objek Firebird",+ firebirdGenerators: "Generator",+ firebirdReadOnlyHint: "Metadata dan sumber tersimpan hanya-baca. Melihat generator tidak menaikkan nilainya.",+ internalFunctions: "Fungsi internal (PSQL)",+ udfFunctions: "UDF / fungsi eksternal",foreignKeys: "Kunci Asing",triggers: "Trigger",events: "Event",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex 57be5194d5..475e89556a 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -4196,6 +4196,11 @@ export default withEnglishFallback({attributes: "Attributi",methods: "Metodi",indexes: "Indici",+ firebirdObjectManager: "Gestione oggetti Firebird",+ firebirdGenerators: "Generatori",+ firebirdReadOnlyHint: "Metadati e sorgente memorizzato in sola lettura. La visualizzazione non incrementa i valori dei generatori.",+ internalFunctions: "Funzioni interne (PSQL)",+ udfFunctions: "UDF / funzioni esterne",foreignKeys: "Chiavi Esterne",triggers: "Trigger",events: "Eventi",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex 1cd5e022c8..54a29ecbd2 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -4219,6 +4219,11 @@ export default withEnglishFallback({attributes: "属性",methods: "メソッド",indexes: "インデックス",+ firebirdObjectManager: "Firebird オブジェクト管理",+ firebirdGenerators: "ジェネレーター",+ firebirdReadOnlyHint: "メタデータと保存されたソースの読み取り専用表示です。ジェネレーターの値は増加しません。",+ internalFunctions: "内部関数 (PSQL)",+ udfFunctions: "UDF / 外部関数",foreignKeys: "外部キー",triggers: "トリガー",events: "イベント",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex 6177b69636..05d256b657 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -4131,6 +4131,11 @@ export default withEnglishFallback({attributes: "속성",methods: "메서드",indexes: "인덱스",+ firebirdObjectManager: "Firebird 객체 관리",+ firebirdGenerators: "생성기",+ firebirdReadOnlyHint: "메타데이터와 저장된 소스를 읽기 전용으로 표시합니다. 생성기 값은 증가하지 않습니다.",+ internalFunctions: "내부 함수 (PSQL)",+ udfFunctions: "UDF / 외부 함수",foreignKeys: "외래 키",triggers: "트리거",events: "이벤트",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex 73e23dab09..dce134a413 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -4198,6 +4198,11 @@ export default withEnglishFallback({attributes: "Atributos",methods: "Métodos",indexes: "Índices",+ firebirdObjectManager: "Gerenciador de objetos Firebird",+ firebirdGenerators: "Geradores",+ firebirdReadOnlyHint: "Metadados e código armazenado somente para leitura. Visualizar geradores não incrementa seus valores.",+ internalFunctions: "Funções internas (PSQL)",+ udfFunctions: "UDF / funções externas",foreignKeys: "Chaves estrangeiras",triggers: "Triggers",events: "Eventos",diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.tsindex 859bdedf49..6f4f851ee6 100644--- a/apps/desktop/src/i18n/locales/ru.ts+++ b/apps/desktop/src/i18n/locales/ru.ts@@ -4318,6 +4318,11 @@ export default withEnglishFallback({attributes: "Атрибуты",methods: "Методы",indexes: "Индексы",+ firebirdObjectManager: "Управление объектами Firebird",+ firebirdGenerators: "Генераторы",+ firebirdReadOnlyHint: "Метаданные и сохранённый код только для чтения. Просмотр не увеличивает значения генераторов.",+ internalFunctions: "Внутренние функции (PSQL)",+ udfFunctions: "UDF / внешние функции",foreignKeys: "Внешние ключи",triggers: "Триггеры",events: "События",diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.tsindex cfbbd0cdd9..994598ca83 100644--- a/apps/desktop/src/i18n/locales/tr.ts+++ b/apps/desktop/src/i18n/locales/tr.ts@@ -3915,6 +3915,11 @@ export default withEnglishFallback({attributes: "Öznitelikler",methods: "Yöntemler",indexes: "Dizinler",+ firebirdObjectManager: "Firebird nesne yönetimi",+ firebirdGenerators: "Üreteçler",+ firebirdReadOnlyHint: "Salt okunur meta veriler ve kayıtlı kaynak. Üreteçleri görüntülemek değerlerini artırmaz.",+ internalFunctions: "Dahili işlevler (PSQL)",+ udfFunctions: "UDF / harici işlevler",foreignKeys: "Yabancı Anahtarlar",triggers: "Tetikleyiciler",events: "Olaylar",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 93d93e7f93..dd6e39c453 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -4408,6 +4408,11 @@ export default withEnglishFallback({attributes: "属性",methods: "方法",indexes: "索引",+ firebirdObjectManager: "Firebird 对象管理",+ firebirdGenerators: "生成器(Generators)",+ firebirdReadOnlyHint: "仅查看元数据和存储的源码。查看生成器不会递增其当前值。",+ internalFunctions: "内部函数(PSQL)",+ udfFunctions: "UDF / 外部函数",foreignKeys: "外键",triggers: "触发器",events: "事件",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex 94c5f58166..dcb7ad1d25 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -4204,6 +4204,11 @@ export default withEnglishFallback({attributes: "屬性",methods: "方法",indexes: "索引",+ firebirdObjectManager: "Firebird 物件管理",+ firebirdGenerators: "產生器(Generators)",+ firebirdReadOnlyHint: "僅檢視中繼資料和儲存的原始碼。檢視產生器不會遞增目前值。",+ internalFunctions: "內部函式(PSQL)",+ udfFunctions: "UDF/外部函式",foreignKeys: "外鍵",triggers: "觸發器",events: "事件",diff --git a/apps/desktop/src/lib/__tests__/table/firebirdObjectTree.spec.ts b/apps/desktop/src/lib/__tests__/table/firebirdObjectTree.spec.tsnew file mode 100644index 0000000000..a901bb041f--- /dev/null+++ b/apps/desktop/src/lib/__tests__/table/firebirdObjectTree.spec.ts@@ -0,0 +1,27 @@+import { describe, it, expect } from "vitest";+import { buildGroupedObjectTreeNodes, buildObjectGroupPlaceholderNodes, objectTypesForGroupNode } from "@/lib/table/tableTree";+import { sidebarObjectKindsForDatabase } from "@/lib/database/databaseObjectCapabilities";++describe("Firebird catalog object groups", () => {+ const base = { nodeId: "c:db", connectionId: "c", database: "db" };+ it("splits PSQL and external functions and gives database indexes their own container", () => {+ const nodes = buildObjectGroupPlaceholderNodes({ ...base, objectTypes: sidebarObjectKindsForDatabase("firebird") });+ expect(nodes.map((node) => node.type)).toEqual(expect.arrayContaining(["group-sequences", "group-packages", "group-triggers", "group-database-indexes", "group-internal-functions", "group-udf-functions"]));+ expect(nodes.map((node) => node.type)).not.toContain("group-functions");+ expect(objectTypesForGroupNode("group-database-indexes")).toEqual(["INDEX"]);+ expect(objectTypesForGroupNode("group-indexes")).toBeNull();+ });+ it("keeps the owning table on an index and qualified package names on functions", () => {+ const nodes = buildGroupedObjectTreeNodes({+ ...base,+ objects: [+ { name: "PK_A_DETAIL", object_type: "INDEX", parent_name: "A_DETAIL" },+ { name: "MYUDR2.F", object_type: "FUNCTION_INTERNAL" },+ { name: "F_ABS", object_type: "FUNCTION_UDF" },+ ],+ });+ expect(nodes.find((node) => node.type === "group-database-indexes")?.children?.[0]).toMatchObject({ type: "index", objectName: "PK_A_DETAIL", tableName: "A_DETAIL" });+ expect(nodes.find((node) => node.type === "group-internal-functions")?.children?.[0]).toMatchObject({ type: "function", objectName: "MYUDR2.F" });+ expect(nodes.find((node) => node.type === "group-udf-functions")?.children?.[0].label).toBe("F_ABS");+ });+});diff --git a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts b/apps/desktop/src/lib/database/databaseObjectCapabilities.tsindex 3ae0e51a64..ff70c9222c 100644--- a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts+++ b/apps/desktop/src/lib/database/databaseObjectCapabilities.ts@@ -1,6 +1,6 @@import type { DatabaseType } from "@/types/database";-export type SidebarObjectKind = "TABLE" | "VIEW" | "MATERIALIZED_VIEW" | "PROCEDURE" | "FUNCTION" | "TRIGGER" | "EVENT" | "SEQUENCE" | "SYNONYM" | "JOB" | "PACKAGE" | "PACKAGE_BODY" | "TYPE" | "TYPE_BODY";+export type SidebarObjectKind = "TABLE" | "VIEW" | "MATERIALIZED_VIEW" | "PROCEDURE" | "FUNCTION" | "FUNCTION_INTERNAL" | "FUNCTION_UDF" | "TRIGGER" | "EVENT" | "SEQUENCE" | "INDEX" | "SYNONYM" | "JOB" | "PACKAGE" | "PACKAGE_BODY" | "TYPE" | "TYPE_BODY";export interface DatabaseObjectCapabilities {sidebarObjects: SidebarObjectKind[];@@ -37,6 +37,7 @@ const ORACLE_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "MATERIALIZED_VIEWconst OCEANBASE_ORACLE_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "MATERIALIZED_VIEW", "PROCEDURE", "FUNCTION", "SEQUENCE", "SYNONYM", "PACKAGE", "PACKAGE_BODY"];const DAMENG_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "MATERIALIZED_VIEW", "PROCEDURE", "FUNCTION", "SEQUENCE", "PACKAGE", "PACKAGE_BODY"];const XUGU_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "PROCEDURE", "FUNCTION", "TRIGGER", "SEQUENCE", "SYNONYM", "PACKAGE", "PACKAGE_BODY", "TYPE", "TYPE_BODY"];+const FIREBIRD_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "PROCEDURE", "FUNCTION_INTERNAL", "FUNCTION_UDF", "TRIGGER", "SEQUENCE", "INDEX", "PACKAGE"];const PACKAGE_MEMBER_EXPANSION_DATABASES = new Set<DatabaseType>(["oracle", "xugu"]);const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([@@ -56,6 +57,7 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([["dameng", DAMENG_OBJECTS],["oceanbase-oracle", OCEANBASE_ORACLE_OBJECTS],["xugu", XUGU_OBJECTS],+ ["firebird", FIREBIRD_OBJECTS],["mysql", MYSQL_OBJECTS],// Explicit entry so schema-diff routine gating can opt in without relying on the// unknown-type ROUTINE_OBJECTS fallback. Keep the same object set the fallback@@ -114,7 +116,7 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([* family databases list types without a CREATE TYPE getter this cycle.*/function isSourceReadableObjectKind(kind: SidebarObjectKind, dbType?: DatabaseType): boolean {- if (kind === "TABLE") return false;+ if (kind === "TABLE" || kind === "INDEX") return false;if (kind === "TYPE" || kind === "TYPE_BODY") return supportsTypeObjectSource(dbType);return true;}@@ -215,6 +217,8 @@ export function supportsPackageMemberExpansion(dbType?: DatabaseType, compatibilexport function normalizeSidebarObjectKind(type: string): SidebarObjectKind {const value = type.toUpperCase();const normalized = value.replace(/[\s-]+/g, "_");+ if (normalized.includes("FUNCTION_INTERNAL")) return "FUNCTION_INTERNAL";+ if (normalized.includes("FUNCTION_UDF")) return "FUNCTION_UDF";if (normalized.includes("PACKAGE_BODY")) return "PACKAGE_BODY";if (normalized.includes("TYPE_BODY")) return "TYPE_BODY";if (normalized.includes("PACKAGE")) return "PACKAGE";@@ -228,5 +232,6 @@ export function normalizeSidebarObjectKind(type: string): SidebarObjectKind {if (value.includes("JOB")) return "JOB";if (value.includes("PROC")) return "PROCEDURE";if (value.includes("FUNC")) return "FUNCTION";+ if (value.includes("INDEX")) return "INDEX";return "TABLE";}diff --git a/apps/desktop/src/lib/sidebar/treeNodeClick.ts b/apps/desktop/src/lib/sidebar/treeNodeClick.tsindex b595215c64..c5d28b599c 100644--- a/apps/desktop/src/lib/sidebar/treeNodeClick.ts+++ b/apps/desktop/src/lib/sidebar/treeNodeClick.ts@@ -91,6 +91,8 @@ const databaseChildGroupNodeTypes = new Set<TreeNodeType>(["group-materialized-views","group-procedures","group-functions",+ "group-internal-functions",+ "group-udf-functions","group-triggers","group-events","group-sequences",diff --git a/apps/desktop/src/lib/table/tableTree.ts b/apps/desktop/src/lib/table/tableTree.tsindex 98fc1c57d5..c0e247d920 100644--- a/apps/desktop/src/lib/table/tableTree.ts+++ b/apps/desktop/src/lib/table/tableTree.ts@@ -722,6 +722,8 @@ function simpleObjectNodeType(objectType: DatabaseObjectTreeKind): TreeNodeTypeif (objectType === "MATERIALIZED_VIEW") return "materialized_view";if (objectType === "PROCEDURE") return "procedure";if (objectType === "FUNCTION") return "function";+ if (objectType === "FUNCTION_INTERNAL" || objectType === "FUNCTION_UDF") return "function";+ if (objectType === "INDEX") return "index";if (objectType === "TRIGGER") return "trigger";if (objectType === "EVENT") return "event";if (objectType === "SEQUENCE") return "sequence";@@ -769,6 +771,20 @@ const groupDefs: Array<{nodeType: "group-functions",childType: "function",},+ {+ key: "__internal_functions",+ label: "tree.internalFunctions",+ objectTypes: ["FUNCTION_INTERNAL"],+ nodeType: "group-internal-functions",+ childType: "function",+ },+ {+ key: "__udf_functions",+ label: "tree.udfFunctions",+ objectTypes: ["FUNCTION_UDF"],+ nodeType: "group-udf-functions",+ childType: "function",+ },{key: "__triggers",label: "tree.triggers",@@ -790,6 +806,13 @@ const groupDefs: Array<{nodeType: "group-sequences",childType: "sequence",},+ {+ key: "__indexes",+ label: "tree.indexes",+ objectTypes: ["INDEX"],+ nodeType: "group-database-indexes",+ childType: "index",+ },{key: "__synonyms",label: "tree.synonyms",@@ -820,7 +843,24 @@ const groupDefs: Array<{},];-const objectGroupNodeTypes = new Set<TreeNodeType>(["group-tables", "group-dolt-system-tables", "group-views", "group-materialized-views", "group-procedures", "group-functions", "group-triggers", "group-events", "group-sequences", "group-synonyms", "group-jobs", "group-packages", "group-types"]);+const objectGroupNodeTypes = new Set<TreeNodeType>([+ "group-tables",+ "group-dolt-system-tables",+ "group-views",+ "group-materialized-views",+ "group-procedures",+ "group-functions",+ "group-internal-functions",+ "group-udf-functions",+ "group-triggers",+ "group-events",+ "group-sequences",+ "group-database-indexes",+ "group-synonyms",+ "group-jobs",+ "group-packages",+ "group-types",+]);export function buildObjectGroupPlaceholderNodes({nodeId,@@ -907,7 +947,7 @@ export function buildGroupedObjectTreeNodes({ nodeId, connectionId, database, scconst objectTypeSuffix = objectType === "PACKAGE" || objectType === "PACKAGE_BODY" || objectType === "TYPE" || objectType === "TYPE_BODY" ? `:${objectType}` : "";const signature = obj.signature?.trim() || "";const signatureIdPart = signature && (objectType === "FUNCTION" || objectType === "PROCEDURE") ? `:${signature}` : "";- const triggerParentName = objectType === "TRIGGER" && obj.parent_name ? normalizeDatabaseObjectName(obj.parent_name) : undefined;+ const triggerParentName = (objectType === "TRIGGER" || objectType === "INDEX") && obj.parent_name ? normalizeDatabaseObjectName(obj.parent_name) : undefined;const triggerParentSchema = objectType === "TRIGGER" && obj.parent_schema ? normalizeDatabaseObjectName(obj.parent_schema) : undefined;return {id: `${nodeId}:${def.key}:${childSchema ? `${childSchema}:` : ""}${obj.name}${signatureIdPart}${triggerParentName ? `:${triggerParentName}` : ""}${objectTypeSuffix}`,diff --git a/apps/desktop/src/lib/table/tableVGroup.ts b/apps/desktop/src/lib/table/tableVGroup.tsindex fde1fec371..1c66027988 100644--- a/apps/desktop/src/lib/table/tableVGroup.ts+++ b/apps/desktop/src/lib/table/tableVGroup.ts@@ -83,6 +83,8 @@ export function tableVGroupKindOfContainerNode(node: Pick<TreeNode, "type" | "tacase "group-procedures":return "procedures";case "group-functions":+ case "group-internal-functions":+ case "group-udf-functions":return "functions";case "group-triggers":// 双栖 type:库级触发器列表与表结构子组共用;表子级带 tableName。diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.tsindex 0709c09bbb..b36d51d19f 100644--- a/apps/desktop/src/types/database.ts+++ b/apps/desktop/src/types/database.ts@@ -1623,6 +1623,7 @@ export type TreeNodeType =| "package-body"| "group-columns"| "group-indexes"+ | "group-database-indexes"| "group-fkeys"| "group-triggers"| "group-events"@@ -1636,6 +1637,8 @@ export type TreeNodeType =| "group-materialized-views"| "group-procedures"| "group-functions"+ | "group-internal-functions"+ | "group-udf-functions"| "group-types"| "group-sequences"| "group-synonyms"diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.jsonindex bffabc6ca2..cd5fb8e3b7 100644--- a/crates/dbx-core/assets/database-drivers.manifest.json+++ b/crates/dbx-core/assets/database-drivers.manifest.json@@ -1442,7 +1442,7 @@"queryExecution": true,"metadataBrowse": true,"objectBrowser": true,- "objectSource": false,+ "objectSource": true,"schemaSearch": true,"diagram": true,"tableDataEdit": true,diff --git a/plugins/connection-types/firebird.yaml b/plugins/connection-types/firebird.yamlindex 57d4cd0294..562087ee0b 100644--- a/plugins/connection-types/firebird.yaml+++ b/plugins/connection-types/firebird.yaml@@ -20,7 +20,7 @@ capabilities:queryExecution: truemetadataBrowse: trueobjectBrowser: true- objectSource: false+ objectSource: trueschemaSearch: truediagram: truetableDataEdit: true