From c2f8ccc8d8d13f32b46bc5f59e0f6aad0a4eb054 Mon Sep 17 00:00:00 2001 From: Denitz <197527+Denitz@users.noreply.github.com> Date: Sat, 23 Dec 2023 23:01:26 +0300 Subject: [PATCH] Skip dump of generated columns --- adminer/include/adminer.inc.php | 9 +++++++++ changes.txt | 1 + todo.txt | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 632e2928..01f1677d 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -831,6 +831,7 @@ class Adminer { $insert = ""; $buffer = ""; $keys = array(); + $generated = array(); $suffix = ""; $fetch_function = ($table != '' ? 'fetch_assoc' : 'fetch_row'); while ($row = $result->$fetch_function()) { @@ -838,6 +839,10 @@ class Adminer { $values = array(); foreach ($row as $val) { $field = $result->fetch_field(); + if ($fields[$field->name]['generated']) { + $generated[$field->name] = true; + continue; + } $keys[] = $field->name; $key = idf_escape($field->name); $values[] = "$key = VALUES($key)"; @@ -855,6 +860,10 @@ class Adminer { $insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', $keys)) . ") VALUES"; } foreach ($row as $key => $val) { + if ($generated[$key]) { + unset($row[$key]); + continue; + } $field = $fields[$key]; $row[$key] = ($val !== null ? unconvert_field($field, preg_match(number_type(), $field["type"]) && !preg_match('~\[~', $field["full_type"]) && is_numeric($val) ? $val : q(($val === false ? 0 : $val))) diff --git a/changes.txt b/changes.txt index b6f0f222..b2b2cf29 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,7 @@ Adminer 4.9.0-dev: Validate connection to server in HTTP based drivers Elasticsearch 5: Make unusable driver usable again, move it to plugins Add new Elasticsearch 7 driver +MySQL: Skip dump of generated columns Adminer 4.8.2: Support multi-line table comments diff --git a/todo.txt b/todo.txt index bf6b9986..d7a0e5cc 100644 --- a/todo.txt +++ b/todo.txt @@ -20,7 +20,6 @@ Joining tables - PRIMARY KEY (table, joining) Rank, Tree structure MySQL: -Generated columns (MySQL >= 5.7.6) Data longer than max_allowed_packet can be sent by mysqli_stmt_send_long_data() MariaDB: