Exemplo n.º 1
0
 public function convertBinaryToString($binary, DataType $dataType)
 {
     switch ($dataType) {
         case DataType::BIT():
             return $binary;
         case DataType::BOOL():
             break;
             ### NUMERIC
         ### NUMERIC
         case DataType::TINYINT():
             return (int) ord($binary);
         case DataType::SMALLINT():
         case DataType::MEDIUMINT():
         case DataType::INT():
         case DataType::BIGINT():
             return $this->strdec($binary);
         case DataType::DEC():
         case DataType::FLOAT():
         case DataType::DOUBLE():
             return $binary;
             ### TIME / DATE
         ### TIME / DATE
         case DataType::DATE():
             return date("Y-m-d", $this->strdec($binary));
         case DataType::DATETIME():
             return date("Y-m-d H:i:s", $this->strdec($binary));
         case DataType::TIMESTAMP():
             return date("Y-m-d H:i:s", $this->strdec($binary));
         case DataType::TIME():
             return date("H:i:s", $this->strdec($binary));
         case DataType::YEAR():
             return (string) $this->strdec($binary);
             ### TEXT
         ### TEXT
         case DataType::CHAR():
         case DataType::VARCHAR():
         case DataType::BINARY():
         case DataType::VARBINARY():
         case DataType::TINYBLOB():
         case DataType::TINYTEXT():
         case DataType::BLOB():
         case DataType::TEXT():
         case DataType::MEDIUMBLOB():
         case DataType::MEDIUMTEXT():
         case DataType::LONGBLOB():
         case DataType::LONGTEXT():
         case DataType::ENUM():
         case DataType::SET():
             return $binary;
     }
 }