Files
dbx/crates/dbx-driver-sqlserver
zipgandzipg f4cb9f1495 fix(sqlserver): stop reading the result stream after the row limit (#13101)
* fix(sqlserver): stop reading after the result row limit

The SQL Server driver kept consuming the whole TDS result stream after the
requested row limit was reached and only flagged the surplus rows as
truncated. A query whose full result set is large therefore spent seconds
draining rows that the caller had already discarded: on a 1.29M-row result
a row-limited execution took 12.8s while the same bounded SQL returned in
about 60ms. Other clients look fast because they stop at the first page.

Stop the stream as soon as the limit is hit, send a best-effort ATTENTION
and mark the connection as abandoned so the pool replaces it instead of
reusing a client that still has unread tokens on the wire. Only executions
that asked for a row limit and are not session-pinned take this path;
multi-statement batches, transactions and pinned sessions keep draining so
later statements and session state stay intact.

* fix(sqlserver): limit stream abandonment to parsed read queries

---------

Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
2026-10-23 01:11:18 +08:00
..
…