Merge pull request #1368 from madhuracj/Bug4537

bug #4537 BLOB inline-view JPG column transformation does not work for anything except simple queries
This commit is contained in:
Madhura Jayaratne 2014-10-06 14:27:04 +05:30
commit 2e05422b1a
3 changed files with 33 additions and 7 deletions

View File

@ -47,6 +47,7 @@ phpMyAdmin - ChangeLog
+ rfe #1542 Better error reporting in Designer
- bug #4547 Micro history does not work in Users page
- bug #4551 Wrong test in source code
- 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)

View File

@ -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');

View File

@ -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