Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgsql-swoole driver can not prompt errors #9

Open
wuxi889 opened this issue Apr 23, 2023 · 1 comment
Open

pgsql-swoole driver can not prompt errors #9

wuxi889 opened this issue Apr 23, 2023 · 1 comment

Comments

@wuxi889
Copy link

wuxi889 commented Apr 23, 2023

app/Controller/TestController.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 日志

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

问题

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

@harryqt
Copy link

harryqt commented Jul 25, 2024

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants