Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

fetchAll return false when the result is empty. #14

Open
andydeng opened this issue Mar 4, 2020 · 0 comments
Open

fetchAll return false when the result is empty. #14

andydeng opened this issue Mar 4, 2020 · 0 comments

Comments

@andydeng
Copy link

andydeng commented Mar 4, 2020

example:

$pg = $this->pgsqlClientDbPool->get(1);
$s = $pg->query("select * from tbl_company where company_id=12312312"); //something not exist
$data = $pg->fetchAll($s); // the $data variable will be false

foreach ($data as $datum) // there is a warning show up
// do something

The $data variable will be FALSE, and a warning shown up in foreach statement. The code will go only if I check whether the $data is false and then give it an empty array value.

It's different behavior than most client implement.

To change this behavior is easy, change line 864 in swoole_postgresql_coro.cc file, from FAILURE to SUCCESS.

The fetchAll above will return an empty array.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant