]> git.joonet.de Git - adminer.git/commitdiff
Illegal mix of collations
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 15 Jan 2010 13:58:29 +0000 (13:58 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 15 Jan 2010 13:58:29 +0000 (13:58 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1297 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/adminer.inc.php
editor/include/adminer.inc.php

index d382e83987ec5f0627004783616e2c2cb0c34490..c19ab338ea06188badfb970e1e2cfef35f99523c 100644 (file)
@@ -323,10 +323,11 @@ class Adminer {
                                        $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");
                                }
                        }
                }
index e65b799a3c3b184f3e65128b5055907f919bf294..568c2fb5e90371ee0a10a59b71e74a08aa6d1be9 100644 (file)
@@ -281,7 +281,7 @@ ORDER BY ORDINAL_POSITION");
                                        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");