11 files changed
+505
-35
No files matched your search
@@ -48,6 +48,10 @@ describe("data grid large-value metadata", () => {
|
||||
columnTypes: ["bigint", "longtext"],
|
||||
largeValuePreviewSize: TABLE_DATA_CELL_PREVIEW_SIZE,
|
||||
});
|
||||
expect(tableDataLargeValuePreviewOptions("db2", [columns[0]!, column("payload", "blob")], ["id"], 100)).toEqual({
|
||||
columnTypes: ["bigint", "blob"],
|
||||
largeValuePreviewSize: TABLE_DATA_CELL_PREVIEW_SIZE,
|
||||
});
|
||||
expect(tableDataLargeValuePreviewOptions("sqlite", columns, ["id"], 100)).toEqual({});
|
||||
expect(tableDataLargeValuePreviewOptions("mysql", columns, [], 100)).toEqual({});
|
||||
expect(tableDataLargeValuePreviewOptions("mysql", [columns[0]!], ["id"], 100)).toEqual({});
|
||||
@@ -124,6 +128,8 @@ describe("data grid large-value metadata", () => {
|
||||
expect(isTableDataVisiblePreviewColumn("postgres", "jsonb")).toBe(true);
|
||||
expect(isTableDataVisiblePreviewColumn("postgres", "text[]")).toBe(false);
|
||||
expect(isTableDataVisiblePreviewColumn("postgres", "vector(1536)")).toBe(false);
|
||||
expect(isTableDataVisiblePreviewColumn("db2", "clob")).toBe(true);
|
||||
expect(isTableDataVisiblePreviewColumn("db2", "blob")).toBe(false);
|
||||
expect(isTableDataVisiblePreviewColumn("oracle", "clob")).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -135,6 +135,9 @@ export function isTableDataVisiblePreviewColumn(databaseType: DatabaseType | und
|
||||
if (databaseType === "postgres") {
|
||||
return !normalized.includes("[") && (base === "char" || base === "character" || base === "varchar" || base === "text" || base === "citext" || base === "name" || base === "xml" || base === "json" || base === "jsonb" || base === "tsvector" || normalized.startsWith("character varying"));
|
||||
}
|
||||
if (databaseType === "db2") {
|
||||
return base === "clob" || base === "dbclob" || base === "char" || base === "character" || base === "varchar" || base === "graphic" || base === "vargraphic";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,7 +178,11 @@ function matchesMysqlUnboundedLargeValueType(base: string): boolean {
|
||||
}
|
||||
|
||||
export function canUseTableDataLargeValuePreview(databaseType: DatabaseType | undefined, columns: readonly ColumnInfo[], primaryKeys: readonly string[]): boolean {
|
||||
return (databaseType === "mysql" || databaseType === "postgres") && columns.length > 0 && primaryKeys.length > 0 && !columns.some((column) => column.name.toLocaleUpperCase().startsWith(TABLE_DATA_LARGE_VALUE_MARKER_PREFIX));
|
||||
return supportsTableDataLargeValuePreview(databaseType) && columns.length > 0 && primaryKeys.length > 0 && !columns.some((column) => column.name.toLocaleUpperCase().startsWith(TABLE_DATA_LARGE_VALUE_MARKER_PREFIX));
|
||||
}
|
||||
|
||||
export function supportsTableDataLargeValuePreview(databaseType: DatabaseType | undefined): boolean {
|
||||
return databaseType === "mysql" || databaseType === "postgres" || databaseType === "db2";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user