hyperf / hyperf/database-pgsql

pgsql-swoole driver can not prompt errors

未关闭
#9 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
12
派生
3
PR 合并指标
30 天内没有已合并 PR

描述

## app/Controller/TestController.php
```php
#[RequestMapping(path: "create", methods: "get")]
public function create(ResponseInterface $response)
{
$s = \App\Model\Session::create([
'id' => '131',
'store_id' => 111,
'uuid' => 'abc',
'visitor_id' => '321',
'user_id' => '0',
'fingerprint' => '11111111111',
'client_ip' => '127.0.0.1',
]);
var_dump($s);
return $response->raw('create session');
}
```
## pgsql 日志
```bash
2023-04-23 13:43:37.125 CST,"track","track",46662,"172.17.0.3:36156",6444c589.b646,7,"PARSE",2023-04-23 13:43:37 CST,3/48,0,LOG,00000,"duration: 1.488 ms parse swoole_stmt_2: insert into ""sessions"" (""id"", ""store_id"", ""uuid"", ""visitor_id"", ""user_id"", ""fingerprint"", ""client_ip"", ""updated_at_gmt"", ""created_at_gmt"") values ($1, $2, $3, $4, $5, $6, $7, $8, $9)",,,,,,,,,"","client backend",,0
2023-04-23 13:43:37.127 CST,"track","track",46662,"172.17.0.3:36156",6444c589.b646,8,"BIND",2023-04-23 13:43:37 CST,3/49,0,LOG,00000,"duration: 0.839 ms bind swoole_stmt_2: insert into ""sessions"" (""id"", ""store_id"", ""uuid"", ""visitor_id"", ""user_id"", ""fingerprint"", ""client_ip"", ""updated_at_gmt"", ""created_at_gmt"") values ($1, $2, $3, $4, $5, $6, $7, $8, $9)","parameters: $1 = '131', $2 = '111', $3 = 'abc', $4 = '321', $5 = '0', $6 = '11111111111', $7 = '127.0.0.1', $8 = '2023-04-23 05:43:37', $9 = '2023-04-23 05:43:37'",,,,,,,,"","client backend",,0
2023-04-23 13:43:37.127 CST,"track","track",46662,"172.17.0.3:36156",6444c589.b646,9,"INSERT",2023-04-23 13:43:37 CST,3/49,0,LOG,00000,"execute swoole_stmt_2: insert into ""sessions"" (""id"", ""store_id"", ""uuid"", ""visitor_id"", ""user_id"", ""fingerprint"", ""client_ip"", ""updated_at_gmt"", ""created_at_gmt"") values ($1, $2, $3, $4, $5, $6, $7, $8, $9)","parameters: $1 = '131', $2 = '111', $3 = 'abc', $4 = '321', $5 = '0', $6 = '11111111111', $7 = '127.0.0.1', $8 = '2023-04-23 05:43:37', $9 = '2023-04-23 05:43:37'",,,,,,,,"","client backend",,0
2023-04-23 13:43:37.128 CST,"track","track",46662,"172.17.0.3:36156",6444c589.b646,10,"INSERT",2023-04-23 13:43:37 CST,3/49,1052,ERROR,23505,"duplicate key value violates unique constraint ""sessions_pkey""","Key (store_id, uuid)=(111, abc) already exists.",,,,,"insert into ""sessions"" (""id"", ""store_id"", ""uuid"", ""visitor_id"", ""user_id"", ""fingerprint"", ""client_ip"", ""updated_at_gmt"", ""created_at_gmt"") values ($1, $2, $3, $4, $5, $6, $7, $8, $9)",,,"","client backend",,0
```
## 响应结果
![image](https://user-images.githubusercontent.com/29323350/233822978-44b3c6e6-e714-4158-a7a6-e30adfd70722.png)

## 问题
当我的数据库驱动使用 `pgsql-swoole` 并使用 `model` 去创建新的数据时,无论写入的 SQL 在数据库里是否发生了错误。 model 总能返回一个正确的对象给我,但 pgsql 里却没有对应的数据。

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。