Skip to content
Browse files

Illegal mix of collations

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1297 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent faa7df8 commit d79b160dd1f9cb08a2011b5610f45107fdb8455b jakubvrana committed Jan 15, 2010
Showing with 4 additions and 3 deletions.
  1. +3 −2 adminer/include/adminer.inc.php
  2. +1 −1 editor/include/adminer.inc.php
View
5 adminer/include/adminer.inc.php
@@ -323,10 +323,11 @@ function selectSearchProcess($fields, $indexes) {
$cols = array();
foreach ($fields as $name => $field) {
if (is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
- $cols[] = $name;
+ $name = idf_escape($name);
+ $cols[] = (ereg('char|text|enum|set', $field["type"]) && !ereg('^utf8', $field["collation"]) ? "CONVERT($name USING utf8)" : $name);
}
}
- $return[] = ($cols ? "(" . implode("$cond OR ", array_map('idf_escape', $cols)) . "$cond)" : "0");
+ $return[] = ($cols ? "(" . implode("$cond OR ", $cols) . "$cond)" : "0");
}
}
}
View
2 editor/include/adminer.inc.php
@@ -281,7 +281,7 @@ function selectSearchProcess($fields, $indexes) {
if ($col != "" || is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
$text_type = ereg('char|text|enum|set', $field["type"]);
$value = $this->processInput($field, ($text_type && ereg('^[^%]+$', $val["val"]) ? "%$val[val]%" : $val["val"]));
- $conds[] = idf_escape($name) . ($value == "NULL" ? " IS" . ($val["op"] == ">=" ? " NOT" : "") : (in_array($val["op"], $this->operators) ? " $val[op]" : ($val["op"] != "=" && $text_type ? " LIKE" : " ="))) . " $value";
+ $conds[] = idf_escape($name) . ($value == "NULL" ? " IS" . ($val["op"] == ">=" ? " NOT" : "") : (in_array($val["op"], $this->operators) ? " $val[op]" : ($val["op"] != "=" && $text_type ? " LIKE" : " ="))) . " $value"; //! can issue "Illegal mix of collations" for columns in other character sets - solve by CONVERT($name using utf8)
}
}
$return[] = ($conds ? "(" . implode(" OR ", $conds) . ")" : "0");

0 comments on commit d79b160

Please sign in to comment.
Something went wrong with that request. Please try again.