fix(mysql): copy varbinary text values as raw strings

This commit is contained in:
jearhe authored and GitHub committed 2026-09-01 01:47:14 +08:00
1 parent cd008b2d56
commit 14ad5ef9bf
8 files changed
+299 -35

No files matched your search

+16 -8
View File
@@ -144,6 +144,7 @@ import {
binaryCellDisplayText,
binaryCellDownloadFileName,
binaryCellDownloadPayload,
binaryCellClipboardText,
canImportBinaryCellFile,
canDownloadBinaryCellValue,
downloadBinaryCellPayload,
@@ -9736,13 +9737,20 @@ async function onGridKeydown(event: KeyboardEvent) {
}
}
function detailClipboardText(detail: DataGridCellDetail): string {
if (detail.value === null) return "";
const binaryText = binaryCellClipboardText(detail.value, detail.type, resolvedDatabaseType.value);
if (binaryText !== null) return binaryText;
if (isBlobCellColumnType(detail.type)) return binaryCellUtf8Text(detail.value, detail.type, resolvedDatabaseType.value) ?? displayCellValue(detail.value);
return displayCellValue(detail.value);
}
async function copyDetailValue() {
const initialDetail = activeCellDetail.value;
if (!initialDetail || !(await hydrateLargeValueCell(initialDetail.rowId, initialDetail.colIndex))) return;
const detail = activeCellDetail.value;
if (!detail) return;
const text = detail.value === null ? "" : isBlobCellColumnType(detail.type) ? (binaryCellUtf8Text(detail.value, detail.type, resolvedDatabaseType.value) ?? displayCellValue(detail.value)) : displayCellValue(detail.value);
copyText(text);
copyText(detailClipboardText(detail));
}
async function copyDetailFormattedJson() {
@@ -9929,7 +9937,7 @@ async function copyRowDetailJson() {
try {
const detail = await resolvedRowDetailForCopy();
if (!detail) return;
copyText(dataGridRowDetailJson(detail));
copyText(dataGridRowDetailJson(detail, undefined, resolvedDatabaseType.value));
} catch (error) {
reportLargeValueLoadError(error);
}
@@ -9939,7 +9947,7 @@ async function copyRowDetailTsv() {
try {
const detail = await resolvedRowDetailForCopy();
if (!detail) return;
copyText(dataGridRowDetailTsv(detail));
copyText(dataGridRowDetailTsv(detail, resolvedDatabaseType.value));
} catch (error) {
reportLargeValueLoadError(error);
}
@@ -9948,14 +9956,14 @@ async function copyRowDetailTsv() {
async function copyRowDetailFieldValue(field: DataGridCellDetail) {
if (!(await hydrateLargeValueCell(field.rowId, field.colIndex))) return;
const resolved = cellDetailFor(field.rowNumber - 1, field.colIndex);
if (resolved) copyText(resolved.value === null ? "" : displayCellValue(resolved.value));
if (resolved) copyText(detailClipboardText(resolved));
}
async function copyColumnDetailJson() {
try {
const detail = await resolvedColumnDetailForCopy();
if (!detail) return;
copyText(dataGridColumnDetailJson(detail));
copyText(dataGridColumnDetailJson(detail, resolvedDatabaseType.value));
} catch (error) {
reportLargeValueLoadError(error);
}
@@ -9965,7 +9973,7 @@ async function copyColumnDetailTsv() {
try {
const detail = await resolvedColumnDetailForCopy();
if (!detail) return;
copyText(dataGridColumnDetailTsv(detail));
copyText(dataGridColumnDetailTsv(detail, resolvedDatabaseType.value));
} catch (error) {
reportLargeValueLoadError(error);
}
@@ -9980,7 +9988,7 @@ function copyColumnDetailColumnName() {
async function copyColumnDetailFieldValue(field: DataGridCellDetail) {
if (!(await hydrateLargeValueCell(field.rowId, field.colIndex))) return;
const resolved = cellDetailFor(field.rowNumber - 1, field.colIndex);
if (resolved) copyText(resolved.value === null ? "" : displayCellValue(resolved.value));
if (resolved) copyText(detailClipboardText(resolved));
}
const transposeRecordWidths = ref<number[]>([]);