Skip to content

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

Closed
MattJackson wants to merge 16 commits into
tiberius-rs:sync/s2from
MattJackson:sync/s3
Closed

fix: land pending community fixes (columns, numeric, IN-lists, packet_size, zeroize, bulk, …)#434
MattJackson wants to merge 16 commits into
tiberius-rs:sync/s2from
MattJackson:sync/s3

Conversation

@MattJackson

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.

DucMinhNe and others added 16 commits September 1, 2026 12:51
(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
(tiberius-rs#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)
…rius-rs#351, tiberius-rs#390, tiberius-rs#411)

- 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 tiberius-rs#390

(cherry picked from commit 09079ca)
Additive helper from upstream tiberius-rs#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
tiberius-rs#430 is already covered by tiberius-rs#419.)

(cherry picked from commit e22dbf9)
From upstream tiberius-rs#376 (author Eric Sheppard) — the numeric.rs IntoSql impl
only; the PR's stale edits to CI/TLS files (already covered by tiberius-rs#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)
@MattJackson

Copy link
Copy Markdown
Contributor Author

Superseded by #441. Re-opened as a native GitHub stacked PR (stack #445) per @aqrln's request in #440 — the fork origin of these PRs made a native stack impossible (GitHub can't add fork-head PRs to a stack), so the branches now live in tiberius-rs/tiberius directly. Same commits, same authorship. Please review #441 instead.

@MattJackson MattJackson closed this Sep 2, 2026
@MattJackson
MattJackson deleted the sync/s3 branch September 2, 2026 15:13
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.