From 4d197aa5dc82f2259155d8827fb97b8dc8fb4274 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 29 Apr 2004 17:35:57 +0000 Subject: [PATCH] Patch 859034 better BLOB comparison --- ChangeLog | 1 + libraries/common.lib.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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'; }