]> git.joonet.de Git - adminer.git/commitdiff
Editor: Cast to string when searching (bug #325)
authorJakub Vrana <jakub@vrana.cz>
Sat, 6 Feb 2021 15:11:21 +0000 (16:11 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 6 Feb 2021 15:11:21 +0000 (16:11 +0100)
changes.txt
editor/include/adminer.inc.php

index 8dc013f7c49451f5257063244b26e5f5560f22ad..bd22131bb7cf54d815047aef275664d2d1d38b03 100644 (file)
@@ -8,6 +8,7 @@ PostgreSQL: Do not show view definition from other schema (PR #392)
 PostgreSQL: Use bigserial for bigint auto increment (bug #765, regression from 3.0.0)
 PostgreSQL 10: Support GENERATED ALWAYS BY IDENTITY (PR #386)
 MS SQL: Don't truncate comments to 30 chars (PR #376)
+Editor: Cast to string when searching (bug #325)
 Re-enable PHP warnings (regression from 4.7.8)
 
 Adminer 4.7.8 (released 2020-12-06):
index 16bb888a2fe567a963fbc69e44d2ce6b63904d74..ae9b0843a303766e60315371440254ca1aacbf3c 100644 (file)
@@ -341,6 +341,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
        }
 
        function selectSearchProcess($fields, $indexes) {
+               global $driver;
                $return = array();
                foreach ((array) $_GET["where"] as $key => $where) {
                        $col = $where["col"];
@@ -356,11 +357,11 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                                                } else {
                                                        $text_type = preg_match('~char|text|enum|set~', $field["type"]);
                                                        $value = $this->processInput($field, (!$op && $text_type && preg_match('~^[^%]+$~', $val) ? "%$val%" : $val));
-                                                       $conds[] = $name . ($value == "NULL" ? " IS" . ($op == ">=" ? " NOT" : "") . " $value"
+                                                       $conds[] = $driver->convertSearch($name, $val, $field) . ($value == "NULL" ? " IS" . ($op == ">=" ? " NOT" : "") . " $value"
                                                                : (in_array($op, $this->operators) || $op == "=" ? " $op $value"
                                                                : ($text_type ? " LIKE $value"
                                                                : " IN (" . str_replace(",", "', '", $value) . ")"
-                                                       ))); //! can issue "Illegal mix of collations" for columns in other character sets - solve by CONVERT($name using utf8)
+                                                       )));
                                                        if ($key < 0 && $val == "0") {
                                                                $conds[] = "$name IS NULL";
                                                        }