Repository navigation
fix: one rowcount per result, each its own, in the server's order - #503
Merged
Merged
Conversation
A PRINT is a result of its own with no count, but it repeated the previous result's count (insert; print gave rowcount 1 twice). Info and mid-batch errors were emitted before the previous result's rowcount and callback, and when an error ended the batch after a result, that result's callback was never called. What comes with a result is now held on it until the result before is complete. A result with no count (PRINT, a lone DDL statement) reports 0. In callback mode the next result waits a tick for the previous result's callback. A cancel still ends the query at once. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… (Linux keeps them) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 25, 2026
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.
Events now follow the server's order, and every result the server reports raises one
rowcountwith its own count. A result with no count gives 0.What the server reports. I checked with raw ODBC, reading
SQLRowCountafter eachSQLMoreResults:declareandsetinside a batch aren't results at all, so they leave no trace.Fixed in
lib/reader.js:insert; printgaverowcount 1,rowcount 1. It now givesrowcount 1,info p1,rowcount 0.select 1; throw ...), that result's callback was never called. It's now called first withmore=true, then the error withmore=false.cancel-cb, HY008,done,free.insert; printinsert 2; create; drop; update 2; print; delete 2select 1; raiserror(16); select 2select 1; throwBehaviour change for the release notes: when a callback query's batch fails after a result, the callback is now called for that result first. node-mssql adds every
rowcounttorowsAffected, soinsert; printnow gives[1, 0]there, where it gave[1, 1].Tests
errors/dup-key-b/c/d,print-then-raiserror,raiserror-after-result,throw-ends-batch,queue/error-after-result-*andscripts/issue-481.compoundqueries.test.js, "rowcount per result" (9 tests; 4 fail on master).multiple-errors.test.jsnow read to the last callback.multiple-errors.test.js: 11 passing;🤖 Generated with Claude Code