Search non-ASCII data only in text columns (bug #3564415)
This commit is contained in:
parent
66d537c150
commit
312075d01f
|
@ -402,9 +402,12 @@ username.form['auth[driver]'].onchange();
|
||||||
// find anywhere
|
// find anywhere
|
||||||
$cols = array();
|
$cols = array();
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
if (is_numeric($val["val"]) || !ereg('int|float|double|decimal|bit', $field["type"])) {
|
$is_text = ereg('char|text|enum|set', $field["type"]);
|
||||||
|
if ((is_numeric($val["val"]) || !ereg('int|float|double|decimal|bit', $field["type"]))
|
||||||
|
&& (!ereg("[\x80-\xFF]", $val["val"]) || $is_text)
|
||||||
|
) {
|
||||||
$name = idf_escape($name);
|
$name = idf_escape($name);
|
||||||
$cols[] = ($jush == "sql" && ereg('char|text|enum|set', $field["type"]) && !ereg('^utf8', $field["collation"]) ? "CONVERT($name USING utf8)" : $name);
|
$cols[] = ($jush == "sql" && $is_text && !ereg('^utf8', $field["collation"]) ? "CONVERT($name USING utf8)" : $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return[] = ($cols ? "(" . implode("$cond OR ", $cols) . "$cond)" : "0");
|
$return[] = ($cols ? "(" . implode("$cond OR ", $cols) . "$cond)" : "0");
|
||||||
|
|
|
@ -798,12 +798,14 @@ function search_tables() {
|
||||||
$name = $adminer->tableName($table_status);
|
$name = $adminer->tableName($table_status);
|
||||||
if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
|
if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
|
||||||
$result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
|
$result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
|
||||||
if ($result->fetch_row()) {
|
if (!$result || $result->fetch_row()) {
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
echo "<ul>\n";
|
echo "<ul>\n";
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
echo "<li><a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>$name</a>\n";
|
echo "<li>" . ($result
|
||||||
|
? "<a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>$name</a>\n"
|
||||||
|
: "$name: <span class='error'>" . error() . "</span>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue