From 3a11358dc731715693f061b8cf9c20a82ee62727 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 6 Jan 2011 09:41:27 +0100 Subject: [PATCH] Use IN for search in numeric fields (Editor) --- changes.txt | 1 + editor/include/adminer.inc.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changes.txt b/changes.txt index 98574d63..2d1676e6 100644 --- a/changes.txt +++ b/changes.txt @@ -8,6 +8,7 @@ MS SQL: auto primary and foreign key SQLite: display 0 Create table default data type: int Homepage customization +Use IN for search in numeric fields (Editor) Work without session.use_cookies (bug #3138640) Portuguese translation diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 1f5fe4f1..4f501705 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -302,7 +302,11 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 } else { $text_type = ereg('char|text|enum|set', $field["type"]); $value = $this->processInput($field, ($text_type && ereg('^[^%]+$', $val) ? "%$val%" : $val)); - $conds[] = idf_escape($name) . ($value == "NULL" ? " IS" . ($op == ">=" ? " NOT" : "") : (in_array($op, $this->operators) ? " $op" : ($op != "=" && $text_type ? " LIKE" : " ="))) . " $value"; //! can issue "Illegal mix of collations" for columns in other character sets - solve by CONVERT($name using utf8) + $conds[] = idf_escape($name) . ($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) } } }