mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-02 10:21:21 +08:00
🐛 fix(sidebar): 兼容国产库视图定位
- 兼容 MySQL 协议国产库返回的 SYSTEM VIEW / BASE VIEW 类型 - 同步 SQL 编辑器与左侧树的视图元数据识别逻辑 - 增加节点元数据缺失时的唯一可视标识兜底定位
This commit is contained in:
@@ -21,7 +21,7 @@ import { formatSqlExecutionError } from '../utils/sqlErrorSemantics';
|
||||
import { findSqlStatementRanges, resolveCurrentSqlStatementRange, resolveExecutableSql } from '../utils/sqlStatementSelection';
|
||||
import { isMacLikePlatform } from '../utils/appearance';
|
||||
import { splitSidebarQualifiedName } from '../utils/sidebarLocate';
|
||||
import { normalizeSidebarViewName } from '../utils/sidebarMetadata';
|
||||
import { isSidebarViewTableType, normalizeSidebarViewName } from '../utils/sidebarMetadata';
|
||||
import { SIDEBAR_SQL_EDITOR_DRAG_MIME, decodeSidebarSqlEditorDragPayload, hasSidebarSqlEditorDragPayload } from '../utils/sidebarSqlDrag';
|
||||
import { resolveUniqueKeyGroupsFromIndexes } from './dataGridCopyInsert';
|
||||
import {
|
||||
@@ -818,6 +818,11 @@ const buildCompletionViewsMetadataQuerySpecs = (dialect: string, dbName: string)
|
||||
? `SELECT TABLE_NAME AS view_name, TABLE_SCHEMA AS schema_name FROM information_schema.views WHERE table_schema = '${safeDbName}' ORDER BY TABLE_NAME`
|
||||
: '',
|
||||
},
|
||||
{
|
||||
sql: safeDbName
|
||||
? `SELECT TABLE_NAME AS view_name, TABLE_SCHEMA AS schema_name, TABLE_TYPE AS table_type FROM information_schema.tables WHERE table_schema = '${safeDbName}' AND UPPER(TABLE_TYPE) LIKE '%VIEW%' ORDER BY TABLE_NAME`
|
||||
: '',
|
||||
},
|
||||
{ sql: dbIdent ? `SHOW FULL TABLES FROM \`${dbIdent}\`` : '' },
|
||||
{ sql: 'SHOW FULL TABLES' },
|
||||
]);
|
||||
@@ -2506,8 +2511,8 @@ const QueryEditor: React.FC<{ tab: TabData; isActive?: boolean }> = ({ tab, isAc
|
||||
const seenViews = new Set<string>();
|
||||
viewResults.forEach((queryResult) => {
|
||||
queryResult.rows.forEach((row) => {
|
||||
const tableType = String(getCaseInsensitiveValue(row, ['table_type', 'table type', 'type']) || '').trim().toUpperCase();
|
||||
if (tableType && tableType !== 'VIEW') return;
|
||||
const tableType = getCaseInsensitiveValue(row, ['table_type', 'table type', 'type']);
|
||||
if (!isSidebarViewTableType(tableType)) return;
|
||||
const schemaName = String(getCaseInsensitiveValue(row, ['schema_name', 'schemaname', 'owner', 'table_schema', 'db']) || '').trim();
|
||||
const rawViewName = String(getCaseInsensitiveValue(row, ['view_name', 'viewname', 'table_name', 'name']) || '').trim() || getFirstRowValue(row);
|
||||
const normalizedViewName = normalizeSidebarViewName(metadataDialect, dbName, schemaName, rawViewName);
|
||||
|
||||
Reference in New Issue
Block a user