Skip to content

Adding duckdb exceptions and result fetch methods#1

Open
chrisBirmingham wants to merge 13 commits intosatur-io:mainfrom
chrisBirmingham:exception-throwing
Open

Adding duckdb exceptions and result fetch methods#1
chrisBirmingham wants to merge 13 commits intosatur-io:mainfrom
chrisBirmingham:exception-throwing

Conversation

@chrisBirmingham
Copy link

@chrisBirmingham chrisBirmingham commented Mar 5, 2026

Hello

Thank you for all your work bringing duckdb to PHP.

This PR adds three new exceptions to the extension, DuckDBException, ConnectionException and QueryException, that are thrown when duckdb fails to connect or query the database. To facilitate this, I've moved the object creation code to the bottom of each function as I've found PHP will fatal if you create the class then throw an exception.

I've also removed the USED_RET code path as I've found that running the code

$db->query('blah')->print();

Would fatal as PHP returned true instead of the result object.

Edit:

I've also updated the PR to include two new fetch methods on the result class that allows pdo style fetching of rows along with adding a usage section to the readme

@chrisBirmingham chrisBirmingham changed the title Adding duckdb exceptions and throw exceptions on duckdb error Adding duckdb exceptions and result fetch methods Mar 10, 2026
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

Successfully merging this pull request may close these issues.

1 participant