Permalink
Browse files

Properly display value of type bit (from MySQL)

  • Loading branch information...
1 parent 6705fb2 commit 8f9576bd78412275fe689f2b9fbcd4b0cf383cc5 @juzna committed Oct 8, 2012
Showing with 13 additions and 0 deletions.
  1. +5 −0 adminer/include/adminer.inc.php
  2. +4 −0 adminer/include/editing.inc.php
  3. +4 −0 editor/include/adminer.inc.php
@@ -205,6 +205,11 @@ function selectVal($val, $link, $field) {
* @return string
*/
function editVal($val, $field) {
+ if ($val === "\0") {
+ return '0';
+ } elseif ($val === "\1") {
+ return '1';
+ }
return $val;
}
@@ -57,6 +57,10 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
foreach ($row as $key => $val) {
if ($val === null) {
$val = "<i>NULL</i>";
+ } elseif ($val === "\0") {
+ $val = "<i>0</i>";
+ } elseif ($val === "\1") {
+ $val = "<i>1</i>";
} elseif ($blobs[$key] && !is_utf8($val)) {
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
} elseif (!strlen($val)) { // strlen - SQLite can return int
@@ -187,6 +187,10 @@ function selectVal($val, $link, $field) {
function editVal($val, $field) {
if (ereg('date|timestamp', $field["type"]) && $val !== null) {
return preg_replace('~^(\\d{2}(\\d+))-(0?(\\d+))-(0?(\\d+))~', lang('$1-$3-$5'), $val);
+ } elseif ($val === "\0") {
+ return 'No';
+ } elseif ($val === "\1") {
+ return 'Yes';
}
return $val;
}

0 comments on commit 8f9576b

Please sign in to comment.