diff --git a/ChangeLog b/ChangeLog index c8a2a1734..833e30f9d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-05-19 Marc Delisle + * tbl_select.php: bug #1204235, searching on a VARBINARY field + 2005-05-18 Marc Delisle * export.php: bug #1193442, 8 extra spaces at end of export area, thanks to Ryan Schmidt diff --git a/tbl_select.php b/tbl_select.php index d9f3fc64b..8b46d3941 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -68,7 +68,16 @@ if (!isset($param) || $param[0] == '') { || strncasecmp($type, 'enum', 4) == 0) { $type = str_replace(',', ', ', $type); } else { - $type = str_replace(array('binary', 'zerofill', 'unsigned'), '', strtolower($type)); + + // strip the "BINARY" attribute, except if we find "BINARY(" because + // this would be a BINARY or VARBINARY field type + if (!preg_match('@BINARY[\(]@i', $type)) { + $type = preg_replace('@BINARY@i', '', $type); + } + $type = preg_replace('@ZEROFILL@i', '', $type); + $type = preg_replace('@UNSIGNED@i', '', $type); + + $type = strtolower($type); } if (empty($type)) { $type = ' '; @@ -411,7 +420,10 @@ else { } // Make query independant from the selected connection charset. - if (PMA_MYSQL_INT_VERSION >= 40101 && $charsets[$i] != $charset_connection && preg_match('@char|binary|blob|text|set@i', $types[$i])) { + // But if the field's type is VARBINARY, it has no charset + // and $charsets[$i] is empty, so we cannot generate a CONVERT + + if (PMA_MYSQL_INT_VERSION >= 40101 && !empty($charsets[$i]) && $charsets[$i] != $charset_connection && preg_match('@char|binary|blob|text|set@i', $types[$i])) { $prefix = 'CONVERT(_utf8 '; $suffix = ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i]; } else {