From 516f62561bb6d5551d0d9801ec4e0b48ed449e18 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 2 Oct 2014 10:10:40 +0530 Subject: [PATCH] bug #4537 BLOB inline-view JPG column transformation does not work for anything except simple queries Signed-off-by: Madhura Jayaratne --- ChangeLog | 1 + libraries/DisplayResults.class.php | 19 ++++++++++++++++++- libraries/Util.class.php | 20 ++++++++++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index faae25fc0b..150792b4f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ phpMyAdmin - ChangeLog + rfe #1529 Avoid session timeout when user is active - bug #4528 Can't import dump via SQL field + rfe #1251 Show "Overhead" with same precision for all tables +- bug #4537 BLOB inline-view JPG column transformation does not work for anything except simple queries 4.2.10.0 (not yet released) - bug #4361 Can't change font size (when config.inc.php not present) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index e21468e7f4..2e6301f502 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -2926,12 +2926,29 @@ class PMA_DisplayResults 'transform_key' => $meta->name, ); + list($transform_where_clause, $clause_is_unique, $condition_array) + = PMA_Util::getUniqueCondition( + $dt_result, + $this->__get('fields_cnt'), + $this->__get('fields_meta'), + $row, + false, + $this->__get('table') + ); + $transform_url_params = array( + 'db' => $this->__get('db'), + 'table' => $this->__get('table'), + 'where_clause' => $transform_where_clause, + 'transform_key' => $meta->name, + ); + if (! empty($sql_query)) { $_url_params['sql_query'] = $url_sql_query; + $transform_url_params['sql_query'] = $url_sql_query; } $transform_options['wrapper_link'] - = PMA_URL_getCommon($_url_params); + = PMA_URL_getCommon($transform_url_params); $vertical_display = $this->__get('vertical_display'); diff --git a/libraries/Util.class.php b/libraries/Util.class.php index f2e47076ef..94f196be44 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -2079,18 +2079,20 @@ class PMA_Util /** * Function to generate unique condition for specified row. * - * @param resource $handle current query result - * @param integer $fields_cnt number of fields - * @param array $fields_meta meta information about fields - * @param array $row current row - * @param boolean $force_unique generate condition only on pk or unique + * @param resource $handle current query result + * @param integer $fields_cnt number of fields + * @param array $fields_meta meta information about fields + * @param array $row current row + * @param boolean $force_unique generate condition only on pk or unique + * @param string $restrict_to_table restrict the unique condition to this table * * @access public * * @return array the calculated condition and whether condition is unique */ public static function getUniqueCondition( - $handle, $fields_cnt, $fields_meta, $row, $force_unique = false + $handle, $fields_cnt, $fields_meta, $row, $force_unique = false, + $restrict_to_table = false ) { $primary_key = ''; $unique_key = ''; @@ -2148,6 +2150,12 @@ class PMA_Util $meta->table = $meta->orgtable; } + // If this field is not from the table which the unique clause needs + // to be restricted to. + if ($restrict_to_table && $restrict_to_table != $meta->table) { + continue; + } + // to fix the bug where float fields (primary or not) // can't be matched because of the imprecision of // floating comparison, use CONCAT