swoole / ext-postgresql

🐘 Coroutine-based client for PostgreSQL
64 stars 21 forks source link

fetch bug when coroutine yield #29

Open Yurunsoft opened 4 years ago

Yurunsoft commented 4 years ago

Code:

<?php

Co\run(function () {
    $pg = new Swoole\Coroutine\PostgreSQL();
    $conn = $pg->connect("host=127.0.0.1 port=5432 dbname=test user=postgres password=1");
    var_dump($conn, $pg->error);
    $res = $pg->query('select * from tb_user');
    \Swoole\Coroutine::sleep(1); // yield
    var_dump($pg->fetchArray($res), $pg->error);
});

Output:

bool(true)
NULL
bool(false)
NULL