hyperf / hyperf/database-pgsql

pgsql-swoole driver can not prompt errors

Abierto
#9 1 comentario 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
12
Forks
3
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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 里却没有对应的数据。

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.