GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make HasRows report whether rows exist by alaricd · Pull Request #1288 · FirebirdSQL/NETProvider

Conversation

@alaricd

@alaricd alaricd commented Oct 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #1284.

Root cause

FbDataReader.HasRows returned _command.HasFields, which is true for any query with columns, including empty result sets.

Change

HasRows now fetches one row ahead before the first Read, and Read/ReadAsync return that buffered row first. Empty, closed, schema-only, and fieldless results report false. The peek is synchronous because HasRows is a synchronous property.

Contract

DbDataReader.HasRows: "true if the DbDataReader contains one or more rows; otherwise false."

Tests

  • HasRowsIsFalseForAnEmptyResultTest: fails without the fix (Assert.IsFalse(reader.HasRows) fails on the upstream code).
  • HasRowsDoesNotSkipTheFirstRowTest: guard for the peek logic. It also passes on the upstream code, because the old HasRows was true for that result.
  • Run locally against Firebird 5.0.2 (firebirdsql/firebird:5.0.2 container): all runnable variants pass. Variants that need the embedded client or a wire-encryption mismatch could not run here.

Verification gaps

  • Firebird 3.0 and 4.0 not run locally. Upstream CI covers them.
  • Embedded and CryptRequired variants not run locally.

AI disclosure

This change was prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cincuranet
cincuranet reviewed Nov 4, 2026
View reviewed changes

@cincuranet cincuranet left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an explicit EXECUTE PROCEDURE command with 1CommandType.StoredProcedure, _command.Fetch()dequeues the output-parameter values into_peekedRow. If the caller checks HasRowsand then closes/disposes the reader without reading,ClosecallsSetOutputParameters`, but the statement’s queue is now empty. Output parameters remain unset; previously, closing the unread reader populated them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@alaricd
Make HasRows report whether rows exist
ad32f38
@alaricd
alaricd force-pushed the fix/has-rows-contract branch from b6075f1 to ad32f38 Compare November 4, 2026 13:50
@alaricd @claude
Keep stored procedure output when HasRows peeks
a31867d
HasRows fetches one row ahead. For a stored procedure that row is the
output-parameter row, so closing the reader without calling Read left
SetOutputParameters with an empty queue and the output parameters unset.
Close and CloseAsync now pass the peeked row to SetOutputParameters.

Also drop a duplicated HasRows assertion and document why _hasPeekedRow
is kept.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
@alaricd
alaricd force-pushed the fix/has-rows-contract branch from 8cf4269 to a31867d Compare November 5, 2026 12:44
@alaricd
Use async reads in HasRows regression test
eac1719
@alaricd

alaricd commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@cincuranet Following up on the November 4 review. All identified issues have been addressed:

  • Removed the duplicate test.
  • Documented why _hasPeekedRow must track whether a fetch occurred independently of _peekedRow.
  • Updated Close() and CloseAsync() to preserve stored-procedure output parameters when HasRows has already fetched the result.
  • Added synchronous and asynchronous regression tests covering HasRows followed by Close without Read.

Both inline review threads are resolved.

The current CI run passes 23/24 jobs. The only failure is Firebird 5 embedded, where the runner exits with code 3 during HasRowsDoesNotSkipTheFirstRowTest, without reporting an assertion failure.

Could you rerun that job to establish whether the failure reproduces, and re-review the current patch?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cincuranet cincuranet cincuranet left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Make FbDataReader.HasRows report whether rows exist

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@alaricd @cincuranet
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.