fix: improve QueryStream::into_results to better handle empty results. (#380) - #385
Open
rebuild1157 wants to merge 1 commit into
Open
fix: improve QueryStream::into_results to better handle empty results. (#380)#385rebuild1157 wants to merge 1 commit into
rebuild1157 wants to merge 1 commit into
Conversation
rebuild1157
marked this pull request as ready for review
July 2, 2025 01:07
joelparkerhenderson
added a commit
to mssql-rust/mssql-rust
that referenced
this pull request
Aug 29, 2026
Mirrors prisma/tiberius#385, fixes upstream issue #380. In a multi-statement batch, into_results() collapsed consecutive empty (0 row) result sets into fewer entries than the number of actual SELECT statements, so a caller had no reliable way to tell which statement in the batch produced which (possibly empty) result. Every QueryStream starts with metadata for its first result set (see the type's own doc comment), so the fixed version uses that guaranteed first item only to check whether there's a result set at all, then counts result sets by Metadata-item boundaries rather than by whether a Vec<Row> happens to be Some/None. Added a regression test reproducing the exact shape from the reported issue (three statements, two returning nothing, one returning a row) - verified it fails against the old code (3 != 2, matching the report) and passes against the fix, live against a real SQL Server (Azure SQL Edge via rustls). Verified: cargo check across all 6 CI feature combinations, cargo clippy --all-targets, cargo fmt --check, cargo test --lib (152 passing), and the new regression test live all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0156Di1tRRLsJK8ctU1AmAJr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix #380