1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 19:44:00 +02:00

Treat binary type as hex

This commit is contained in:
Jakub Vrana
2010-09-28 10:02:55 +02:00
parent 4af4018a06
commit 5a73c01212
5 changed files with 15 additions and 10 deletions

View File

@@ -150,8 +150,8 @@ document.getElementById('username').focus();
* @return string
*/
function selectVal($val, $link, $field) {
$return = ($val != "<i>NULL</i>" && $field["type"] == "char" ? "<code>$val</code>" : $val);
if (ereg('binary|blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
$return = ($val != "<i>NULL</i>" && ereg("^char|binary", $field["type"]) ? "<code>$val</code>" : $val);
if (ereg('blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES)));
}
return ($link ? "<a href='$link'>$return</a>" : $return);
@@ -163,7 +163,7 @@ document.getElementById('username').focus();
* @return string
*/
function editVal($val, $field) {
return $val;
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
}
/** Print columns box in select
@@ -449,9 +449,12 @@ document.getElementById('username').focus();
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
} elseif (ereg('^(addtime|subtime|concat)$', $function)) {
$return = "$function(" . idf_escape($name) . ", $return)";
} elseif (ereg('^(md5|sha1|password|encrypt)$', $function)) {
} elseif (ereg('^(md5|sha1|password|encrypt|hex)$', $function)) {
$return = "$function($return)";
}
if (ereg("binary", $field["type"])) {
$return = "unhex($return)";
}
return $return;
}