feat(oracle): Ctrl/Cmd+click 打开存储过程源码

* feat(oracle): open procedure source via Ctrl/Cmd+click in SQL editor

Allow navigating from SQL identifiers to routine source like DataGrip/DBeaver.
Call sites open immediately without a global ALL_OBJECTS scan, and query-tab
views wrap bare Oracle ALL_SOURCE as CREATE OR REPLACE for editable DDL.

Close #5290

* fix(oracle): harden Ctrl/Cmd+click navigation identity model

Address review feedback on routine navigation correctness:
- Distinguish relation column lists (INSERT INTO t(...)) from routine calls
- Resolve schema.routine vs package.member before optimistic open
- Preserve quoted mixed-case identities for Oracle ALL_SOURCE lookup
- Try exact then uppercase name candidates in the Oracle Go agent
This commit is contained in:
Yy-702 authored and GitHub committed 2026-08-05 23:57:50 +08:00
1 parent 44e0eff76e
commit e749bdd42c
11 files changed
+1005 -46

No files matched your search

@@ -8,6 +8,7 @@ import { useSettingsStore } from "@/stores/settingsStore";
import { copyToClipboard } from "@/lib/common/clipboard";
import { formatSqlForDisplay, type SqlFormatDialect } from "@/lib/sql/sqlFormatter";
import { buildEditableObjectSource, buildExecutableObjectSourceStatements, executeObjectSourceSave, formatObjectSourceSaveError } from "@/lib/table/objectSourceEditor";
import { loadObjectSourceWithRoutineFallback } from "@/lib/table/objectSourceLoad";
import { executeWithProductionSqlGuard } from "@/lib/database/productionExecutionGuard";
import * as api from "@/lib/backend/api";
import QueryEditor from "@/components/editor/QueryEditor.vue";
@@ -54,6 +55,8 @@ const editing = ref(false);
const sourceEditable = ref(true);
const error = ref("");
const saveError = ref("");
/** May differ from props.objectType after PROCEDURE/FUNCTION/PACKAGE fallback resolution. */
const resolvedObjectType = ref<ObjectSourceKind>(props.objectType);
let loadSerial = 0;
const canEdit = computed(() => sourceEditable.value && props.objectType !== "SEQUENCE");
@@ -80,16 +83,17 @@ async function loadSource(nextEditing = props.initialEditing && canEdit.value) {
try {
if (!props.databaseType) throw new Error("Connection type is unavailable.");
const schema = props.schema || props.database;
const result = await api.getObjectSource(props.connectionId, props.database, schema, props.name, props.objectType, props.signature, props.relationName);
const { source: result, objectType: resolvedType } = await loadObjectSourceWithRoutineFallback(api.getObjectSource, props.connectionId, props.database, schema, props.name, props.objectType, props.signature, props.relationName);
const editableAllowed = result.editable !== false;
const editable = await buildEditableObjectSource({
databaseType: props.databaseType,
objectType: props.objectType,
objectType: resolvedType,
schema,
name: props.name,
source: result.source,
});
if (serial !== loadSerial) return;
resolvedObjectType.value = resolvedType;
sourceEditable.value = editableAllowed;
const formatted = await formatSqlForDisplay(editable, props.formatDialect ?? props.dialect, settingsStore.editorSettings.sqlFormatter);
editableText.value = editable;
@@ -145,7 +149,7 @@ async function saveSource() {
try {
const statements = await buildExecutableObjectSourceStatements({
databaseType,
objectType: props.objectType,
objectType: resolvedObjectType.value,
schema,
name: props.name,
source: draft.value,