swoole / ext-postgresql

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

Prepared Statement Bug #16

Open razzbee opened 4 years ago

razzbee commented 4 years ago

Hello, errors in a prepared statement doesn't get reported, example:

$stmt = $db->prepare("my_query, "SELECT * from non_existing_table");

Here, non_existing_table doesnt exists, but $stmt returns true
and also :

$db->error is null

codercms commented 4 years ago

@sy-records I can confirm this is a bug, prepare is always returning true even if it fails. https://github.com/swoole/ext-postgresql/blob/v4.4.x/swoole_postgresql_coro.cc#L620

codercms commented 4 years ago

I fixed it in this PR - https://github.com/swoole/ext-postgresql/pull/19 (https://github.com/swoole/ext-postgresql/pull/19/files#diff-f6c52869d82feeba7cef8b1ab64732daR652)

sy-records commented 4 years ago

Thanks for your contribution, please wait for review. @codercms

codercms commented 4 years ago

@razzbee #19 is merged into v4.4.x branch. Can you confirm that your issue is resolved?

razzbee commented 4 years ago

I will provide a feedback after testing, Thanks