fix(sqlserver): display long varchar query results

This commit is contained in:
zipg authored and GitHub committed 2026-07-20 00:52:31 +08:00
1 parent 5289dc819d
commit 0d2b6685d3
5 files changed
+87 -10

No files matched your search

@@ -1,5 +1,8 @@
export type CellValue = string | number | boolean | null;
export const DATA_GRID_CELL_DISPLAY_MAX_LENGTH = 256;
export const SQLSERVER_DATA_GRID_CELL_DISPLAY_MAX_LENGTH = 8_000;
export function displayCellValue(value: CellValue): string {
if (value === null) return "NULL";
if (typeof value === "boolean") return value ? "true" : "false";
@@ -11,3 +14,8 @@ export function firstLineCellDisplayValue(value: string): string {
const lineBreakIndex = value.search(/\r\n|\r|\n/);
return lineBreakIndex === -1 ? value : value.slice(0, lineBreakIndex);
}
export function limitDataGridCellDisplay(value: string, maxLength = DATA_GRID_CELL_DISPLAY_MAX_LENGTH): string {
if (value.length <= maxLength) return value;
return `${value.slice(0, maxLength)}...`;
}