From 7eff7c649cd580b130c89435c2d4fa70a1cbfe9c Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 17 Oct 2021 11:36:53 +0200 Subject: [PATCH] fix --- packages/web/src/datagrid/DataGridCell.svelte | 2 +- packages/web/src/utility/clipboard.js | 2 +- plugins/dbgate-plugin-mysql/src/frontend/Dumper.js | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/web/src/datagrid/DataGridCell.svelte b/packages/web/src/datagrid/DataGridCell.svelte index 57fcc169..75945192 100644 --- a/packages/web/src/datagrid/DataGridCell.svelte +++ b/packages/web/src/datagrid/DataGridCell.svelte @@ -99,7 +99,7 @@ {:else} {highlightSpecialCharacters(value)} {/if} - {:else if value.type == 'Buffer' && _.isArray(value.data)} + {:else if value?.type == 'Buffer' && _.isArray(value.data)} {#if value.data.length <= 16} {arrayToHexString(value.data)} {:else} diff --git a/packages/web/src/utility/clipboard.js b/packages/web/src/utility/clipboard.js index 1b2ad601..045af4e9 100644 --- a/packages/web/src/utility/clipboard.js +++ b/packages/web/src/utility/clipboard.js @@ -67,7 +67,7 @@ export function extractRowCopiedValue(row, col) { if (value === undefined) value = _.get(row, col); if (value === null) return '(NULL)'; if (value === undefined) return '(NoField)'; - if (value.type == 'Buffer' && _.isArray(value.data)) return arrayToHexString(value.data); + if (value && value.type == 'Buffer' && _.isArray(value.data)) return arrayToHexString(value.data); if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value); return value; } diff --git a/plugins/dbgate-plugin-mysql/src/frontend/Dumper.js b/plugins/dbgate-plugin-mysql/src/frontend/Dumper.js index 2081f531..cbfecd69 100644 --- a/plugins/dbgate-plugin-mysql/src/frontend/Dumper.js +++ b/plugins/dbgate-plugin-mysql/src/frontend/Dumper.js @@ -66,8 +66,11 @@ class Dumper extends SqlDumper { } putValue(value) { - if (value.type == 'Buffer' && _isArray(value.data)) this.putRaw(`unhex('${arrayToHexString(value.data)}')`); - else super.putValue(value); + if (value && value.type == 'Buffer' && _isArray(value.data)) { + this.putRaw(`unhex('${arrayToHexString(value.data)}')`); + } else { + super.putValue(value); + } } }