This commit is contained in:
2021-04-16 20:36:29 +08:00
parent 7013073968
commit 48616882a0
+8 -4
View File
@@ -11,11 +11,11 @@ declare(strict_types=1);
namespace Database\Mysql; namespace Database\Mysql;
use Database\Connection;
use Database\SqlBuilder; use Database\SqlBuilder;
use Exception;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Component; use Snowflake\Abstracts\Component;
use Database\Connection;
use Exception;
use Snowflake\Core\Json; use Snowflake\Core\Json;
/** /**
@@ -155,7 +155,11 @@ class Columns extends Component
if ($this->isInt($format)) { if ($this->isInt($format)) {
return (int)$val; return (int)$val;
} else if ($this->isJson($format)) { } else if ($this->isJson($format)) {
return Json::encode($val); $data = Json::encode($val);
if (is_bool($data)) {
return Json::encode([]);
}
return $data;
} else if ($this->isFloat($format)) { } else if ($this->isFloat($format)) {
return (float)$val; return (float)$val;
} else { } else {
@@ -224,7 +228,7 @@ class Columns extends Component
/** /**
* @param $name * @param string $name
* @return bool * @return bool
* @throws Exception * @throws Exception
*/ */