mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 00:55:35 +08:00
fix some sql bugs
This commit is contained in:
@@ -38,7 +38,11 @@ $config['sql_config'] = [
|
|||||||
'sql_database' => 'db_name',
|
'sql_database' => 'db_name',
|
||||||
'sql_password' => '',
|
'sql_password' => '',
|
||||||
'sql_enable_cache' => true,
|
'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 */
|
/** CQHTTP连接约定的token */
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ trait WhereBody
|
|||||||
protected $where_thing = [];
|
protected $where_thing = [];
|
||||||
|
|
||||||
public function where($column, $operation_or_value, $value = null) {
|
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;
|
elseif ($value !== null) $this->where_thing[$operation_or_value][$column] = $value;
|
||||||
else $this->where_thing['='][$column] = $operation_or_value;
|
else $this->where_thing['='][$column] = $operation_or_value;
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class EventHandler
|
|||||||
" [" . $param1->getStatusCode() . "] " . $param0->server["request_uri"]
|
" [" . $param1->getStatusCode() . "] " . $param0->server["request_uri"]
|
||||||
);
|
);
|
||||||
if (!$param1->isEnd()) $param1->end("Internal server error: " . $e->getMessage());
|
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");
|
Console::log($e->getTraceAsString(), "gray");
|
||||||
} catch (Error $e) {
|
} catch (Error $e) {
|
||||||
/** @var Response $param1 */
|
/** @var Response $param1 */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class RequestEvent implements SwooleEvent
|
|||||||
$this->response->setHeader($k, $v);
|
$this->response->setHeader($k, $v);
|
||||||
}
|
}
|
||||||
$uri = $this->request->server["request_uri"];
|
$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 = explode("/", $uri);
|
||||||
$uri = array_diff($uri, ["..", "", "."]);
|
$uri = array_diff($uri, ["..", "", "."]);
|
||||||
$node = ZMBuf::$req_mapping;
|
$node = ZMBuf::$req_mapping;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class WorkerStartEvent implements SwooleEvent
|
|||||||
->withCharset('utf8mb4')
|
->withCharset('utf8mb4')
|
||||||
->withUsername($sql["sql_username"])
|
->withUsername($sql["sql_username"])
|
||||||
->withPassword($sql["sql_password"])
|
->withPassword($sql["sql_password"])
|
||||||
->withOptions([PDO::ATTR_STRINGIFY_FETCHES => false])
|
->withOptions($sql["sql_options"] ?? [PDO::ATTR_STRINGIFY_FETCHES => false])
|
||||||
);
|
);
|
||||||
DB::initTableList();
|
DB::initTableList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user