diff --git a/config/global.php b/config/global.php index 4d367baf..919c42a7 100644 --- a/config/global.php +++ b/config/global.php @@ -38,7 +38,11 @@ $config['sql_config'] = [ 'sql_database' => 'db_name', 'sql_password' => '', 'sql_enable_cache' => true, - 'sql_reset_cache' => '0300' + 'sql_reset_cache' => '0300', + 'sql_options' => [ + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::ATTR_EMULATE_PREPARES => false + ] ]; /** CQHTTP连接约定的token */ diff --git a/src/ZM/DB/WhereBody.php b/src/ZM/DB/WhereBody.php index ec5ca4de..2ede73f1 100644 --- a/src/ZM/DB/WhereBody.php +++ b/src/ZM/DB/WhereBody.php @@ -9,7 +9,7 @@ trait WhereBody protected $where_thing = []; public function where($column, $operation_or_value, $value = null) { - if (!in_array($operation_or_value, ['=', '!='])) $this->where_thing['='][$column] = $operation_or_value; + if (!in_array($operation_or_value, ['=', '!=', '>', '<', '>=', '<=', 'IN', 'in'])) $this->where_thing['='][$column] = $operation_or_value; elseif ($value !== null) $this->where_thing[$operation_or_value][$column] = $value; else $this->where_thing['='][$column] = $operation_or_value; return $this; diff --git a/src/ZM/Event/EventHandler.php b/src/ZM/Event/EventHandler.php index b6d33656..0dafdf80 100644 --- a/src/ZM/Event/EventHandler.php +++ b/src/ZM/Event/EventHandler.php @@ -85,7 +85,7 @@ class EventHandler " [" . $param1->getStatusCode() . "] " . $param0->server["request_uri"] ); if (!$param1->isEnd()) $param1->end("Internal server error: " . $e->getMessage()); - Console::error("Internal server error (500), caused by uncaught exception."); + Console::error("Internal server exception (500), caused by ".get_class($e)); Console::log($e->getTraceAsString(), "gray"); } catch (Error $e) { /** @var Response $param1 */ diff --git a/src/ZM/Event/Swoole/RequestEvent.php b/src/ZM/Event/Swoole/RequestEvent.php index e4424c1e..83b38552 100644 --- a/src/ZM/Event/Swoole/RequestEvent.php +++ b/src/ZM/Event/Swoole/RequestEvent.php @@ -42,7 +42,7 @@ class RequestEvent implements SwooleEvent $this->response->setHeader($k, $v); } $uri = $this->request->server["request_uri"]; - Console::verbose($this->request->server["remote_addr"]." request ".$uri); + Console::verbose($this->request->server["remote_addr"] . " request " . $uri); $uri = explode("/", $uri); $uri = array_diff($uri, ["..", "", "."]); $node = ZMBuf::$req_mapping; diff --git a/src/ZM/Event/Swoole/WorkerStartEvent.php b/src/ZM/Event/Swoole/WorkerStartEvent.php index a996c356..b45462d3 100644 --- a/src/ZM/Event/Swoole/WorkerStartEvent.php +++ b/src/ZM/Event/Swoole/WorkerStartEvent.php @@ -102,7 +102,7 @@ class WorkerStartEvent implements SwooleEvent ->withCharset('utf8mb4') ->withUsername($sql["sql_username"]) ->withPassword($sql["sql_password"]) - ->withOptions([PDO::ATTR_STRINGIFY_FETCHES => false]) + ->withOptions($sql["sql_options"] ?? [PDO::ATTR_STRINGIFY_FETCHES => false]) ); DB::initTableList(); }