fix(hana): show character field length in column types

This commit is contained in:
zipg authored and GitHub committed 2026-09-02 17:05:11 +08:00
1 parent f5113def38
commit c813b76019
6 files changed
+68 -10

No files matched your search

+10 -9
View File
@@ -96,7 +96,7 @@ import type { BuildSingleColumnAlterSqlOptions } from "@/lib/table/tableStructur
import { buildTableSelectSql, qualifyTableReferencesInSql, quoteTableDataIdentifier } from "@/lib/table/tableSelectSql";
import { uuid } from "@/lib/common/utils";
import { generateCellValues, type CellValueGenerationKind } from "@/lib/dataGrid/cellValueGeneration";
import { compactHeaderColumnType, isNumericColumnType, resolveDataGridTypeVisualKind, resolveHeaderColumnType, resolveResultColumnType } from "@/lib/dataGrid/dataGridColumnType";
import { compactHeaderColumnType, formatMetadataColumnTypeLabel, isNumericColumnType, resolveDataGridTypeVisualKind, resolveHeaderColumnType, resolveResultColumnType } from "@/lib/dataGrid/dataGridColumnType";
import { dataGridCellTextClass, dataGridTypeVisualClass } from "@/lib/dataGrid/dataGridCellTextVisual";
import { DATA_GRID_TYPE_COLOR_KEYS, resolveActiveDataGridTypeColors } from "@/lib/dataGrid/dataGridTypeColorScheme";
import {
@@ -668,14 +668,15 @@ const columnTypeMap = computed(() => {
const map = new Map<string, string>();
if (props.tableMeta?.columns) {
for (const col of props.tableMeta.columns) {
const typeName = shortTypeName(col.data_type);
// Add precision for numeric/decimal types
if (col.numeric_precision != null && ["numeric", "decimal"].includes(col.data_type.toLowerCase())) {
const scale = col.numeric_scale ?? 0;
map.set(col.name, `${typeName}(${col.numeric_precision},${scale})`);
} else {
map.set(col.name, typeName);
}
map.set(
col.name,
formatMetadataColumnTypeLabel({
dataType: shortTypeName(col.data_type),
characterMaximumLength: col.character_maximum_length,
numericPrecision: col.numeric_precision,
numericScale: col.numeric_scale,
}),
);
}
}
return map;