Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Properly display value of type bit (from MySQL) #28

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+13 −0
Split
@@ -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;
}