diff --git a/ChangeLog b/ChangeLog index 83bd57e1f..8bd98a7c4 100755 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ $Source$ * lang/slovak: Updated, thanks to Lubos Klokner (erkac). * lang/swedish: Updated, thanks to Björn T. Hallberg (bth). * lang/slovenian update, thanks to Kositer Uros + * libraries/common.lib.php: patch #859034, better BLOB comparison 2004-04-29 Michal Cihar * libraries/display_tbl.lib.php, libraries/sqlparser.lib.php, diff --git a/libraries/common.lib.php b/libraries/common.lib.php index f79a98fc0..09d2c3472 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1971,7 +1971,13 @@ if (typeof(document.getElementById) != 'undefined' // hexify only if this is a true not empty BLOB && stristr($field_flags, 'BINARY') && !empty($row[$i])) { - $condition .= 'LIKE 0x' . bin2hex($row[$i]). ' AND'; + // use a CAST if possible, to avoid problems + // if the field contains wildcard characters % or _ + if (PMA_MYSQL_INT_VERSION < 40002) { + $condition .= 'LIKE 0x' . bin2hex($row[$i]). ' AND'; + } else { + $condition .= '= CAST(0x' . bin2hex($row[$i]). ' AS BINARY) AND'; + } } else { $condition .= '= \'' . PMA_sqlAddslashes($row[$i], FALSE, TRUE) . '\' AND'; }