Calling #fetch on an #exhausted? result set throws a Firebird "Request Synchronization Error," rather than repeatedly returning nil, as I'd expect from the documentation.
How to reproduce
See new unit test added in this pull request. Or, issue a SELECT, iterate with #each() or any Enumerable method on the ResultSet, and then call #fetch().
Proposed fixes
A few ways I can think of:
Check result->exhausted before attempting a isc_dsql_fetch
This is what this Pull Request implements.
Issue
Calling
#fetch
on an#exhausted?
result set throws a Firebird "Request Synchronization Error," rather than repeatedly returning nil, as I'd expect from the documentation.How to reproduce
See new unit test added in this pull request. Or, issue a SELECT, iterate with
#each()
or any Enumerable method on the ResultSet, and then call#fetch()
.Proposed fixes
A few ways I can think of:
result->exhausted
before attempting aisc_dsql_fetch
This is what this Pull Request implements.isc_req_sync
errors thrown after anisc_dsql_fetch
if we are exhausted. Implemented here: https://github.com/pilcrow/rubyfb/tree/exhausted-fetch