Skip to content

fix: land pending community fixes (columns, numeric, IN-lists, packet_size, zeroize, bulk, …) - #441

Open
MattJackson wants to merge 17 commits into
stack/s2from
stack/s3
Open

fix: land pending community fixes (columns, numeric, IN-lists, packet_size, zeroize, bulk, …)#441
MattJackson wants to merge 17 commits into
stack/s2from
stack/s3

Conversation

@MattJackson

@MattJackson MattJackson commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

A batch of community-contributed fixes, each kept as a standalone commit with its original author preserved:

Supersedes #296, #304, #351, #359, #376, #385, #388, #390, #400, #411, #423, #429.
Complementary — not superseded, please keep open: #387 (@polina-alekseeva-rogii) adds ]]] escaping beyond #388.

Sequential series — merge in order after #432, #433. Based on main, so its diff reduces to its own 16 commits once the earlier PRs land.
Reviewer note: please rebase-merge or merge-commit, not squash — these carry each contributor's authorship; squashing collapses that credit.

@MattJackson MattJackson changed the title stack/s3 fix: land pending community fixes (columns, numeric, IN-lists, packet_size, zeroize, bulk, …) Sep 2, 2026
@MattJackson
MattJackson force-pushed the stack/s3 branch 3 times, most recently from 6ece6d2 to 6954578 Compare September 2, 2026 21:17
DucMinhNe and others added 17 commits September 2, 2026 16:59
(cherry picked from commit d5dabee)
(cherry picked from commit 352dc9e)
This commit surrounds column names with square brackets so that any conflicts
with SQL keywords don't cause errors. Looking at other PRs it looks like this
also allows column names with spaces in them to be used.

(cherry picked from commit b95ced7)
(cherry picked from commit ff65ebc)
(cherry picked from commit 895ae39)
(cherry picked from commit abb378a)
SQL Server has no array parameter, so an IN list must name one placeholder
per value. Binding a comma-separated string to IN (@p1) matches nothing
rather than failing, so every caller ends up writing the same format loop
(#157).

Adds four small, additive items to Query:

  Query::placeholders(first, count) -> String   builds "@p1, @p2, @p3"
  Query::bind_iter(iter)                        binds each item in order
  Query::param_count() -> usize                 how many are bound
  Query::MAX_PARAMETERS: usize = 2100           the server's limit

MAX_PARAMETERS matters most for exactly these runtime-sized statements: an
IN list or a multi-row INSERT reaches the limit by data volume, on a batch
that may be larger than any that was tested, and the server reports it only
after the whole batch has been sent.

No public API changes; nothing is renamed or removed. Eight unit tests and
four doc tests, none of which need a server.

(cherry picked from commit 9071362)
(cherry picked from commit c90714a)
(cherry picked from commit 7a201ca)
(cherry picked from commit 2cb13e2)
(cherry picked from commit 6c8d96b)
(cherry picked from commit 9e65ac9)
(cherry picked from commit 6dd26c0)
(cherry picked from commit 50703ec)
Add the ability to configure the TDS packet size in the LOGIN7 message.
Larger packet sizes can significantly improve bulk insert performance
by reducing network round-trips and protocol overhead.

The default packet size remains 4096 bytes for backwards compatibility.
Valid values are 512 to 32767 bytes. The server may negotiate a
different size than requested.

Example usage:
```rust
let mut config = Config::new();
config.packet_size(32767);  // Request 32KB packets
```

Performance testing showed that increasing packet size from 4KB to 16KB
improved bulk insert throughput by ~40% (from 104K to 178K rows/sec
for a 19.3M row dataset).

(cherry picked from commit 23aedd6)
(cherry picked from commit 6110ce9)
(cherry picked from commit d191c1e)
(cherry picked from commit 01274b6)
(cherry picked from commit f49b35b)
(cherry picked from commit 195ef3b)
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
Additive helper from upstream #430 (author Joel Parker Henderson): brings a
SQL Server container up under podman or docker, defaults to arm64-friendly
azure-sql-edge, and polls the log for readiness. (The cert-renewal part of
#430 is already covered by #419.)

(cherry picked from commit e22dbf9)
From upstream #376 (author Eric Sheppard) — the numeric.rs IntoSql impl
only; the PR's stale edits to CI/TLS files (already covered by #419) are
omitted. Lets a rust_decimal Decimal be bound directly in queries.

(cherry picked from commit 54bf399)
Adds `bulk_insert_columns(self, table, columns)` and turns `bulk_insert(self, table)` into
a compatibility shim that calls `self.bulk_insert_columns(table, &["*"])`, maintaining the
existing behaviour.

(cherry picked from commit 3ce3444)
(cherry picked from commit 6ad9497)
(cherry picked from commit b114498)
The bulk_insert and bulk_insert_columns doctests both created global temp
table ##bulk_test; run in parallel they raced and one hit error 2714
('object already exists'). Give each a distinct name so they never collide.
@MattJackson MattJackson closed this Sep 3, 2026
@MattJackson MattJackson reopened this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.