Migrate SQL Server driver from tiberius to mssql-tiberius-bridge#170
Merged
debba merged 3 commits intoMay 10, 2026
Merged
Conversation
Replace the tiberius crate with mssql-tiberius-bridge, which provides
a tiberius-compatible API surface (row.get/try_get, query, simple_query,
into_first_result, Config builder) on top of Microsoft's official
mssql-tds protocol implementation.
Key changes:
Cargo.toml:
- Replace tiberius + tokio-util deps with mssql-tiberius-bridge git dep
- tokio-util removed (no other drivers use compat)
pool.rs (complete rewrite):
- Replace TiberiusManager/TiberiusConnection with BridgeManager/BridgeConnection
- BridgeManager pools mssql_tiberius_bridge::Client objects directly
(not raw TdsClient), so introspection code can use .query()/.simple_query()
- Config builder uses bridge's fluent API (host/port/database/authentication)
pool_manager.rs:
- Update imports and type aliases to use BridgeManager
extract/mod.rs:
- Replace tiberius::{ColumnType, Row, numeric::Numeric} with bridge types
- Update ColumnType variant names to match bridge enum:
Bitn→Bit, Intn removed (bridge maps IntN→Int4), Floatn→Float8,
Datetimen→Datetime, DatetimeOffsetn→DatetimeOffset, Daten→Date,
Timen→Time, BigVarChar→Varchar, BigChar→Char, BigBinary→Binary,
SSVariant→Ssvariant, Udt removed (not in bridge)
- Add Json/Vector/VarBinary coverage for new bridge column types
- Replace &[u8] with Vec<u8> for binary extraction (bridge FromSql)
- Remove Numeric fallback (bridge uses rust_decimal::Decimal directly)
- Remove read_intn helper (bridge resolves IntN at protocol level)
introspection.rs:
- Replace TiberiusConnection with BridgeConnection
- Replace tiberius::Row references with mssql_tiberius_bridge::Row
- Remove .await from .into_first_result() calls (bridge version is sync)
mod.rs:
- Update acquire() return type to use BridgeManager
- Fix Column field access: c.name() → c.name (bridge uses pub field)
- Remove .await from .into_first_result() calls
version.rs: No changes (pure module, no tiberius dependency)
Use published mssql-tiberius-bridge v0.1.0-preview.1 from crates.io instead of git dependency.
11 tasks
Contributor
Author
|
@debba This is ready for review |
Breaking changes from preview.1 → preview.3: - Column.name is now pub(crate): use name() getter - Column.column_type is now pub(crate): use column_type() getter Also picks up new features: - Config::trust_cert_ca for CA pinning - ToSql for Vec<u8>, &[u8], and chrono date/time types - Config::readonly() for ApplicationIntent=ReadOnly - AuthMethod::aad_token for Entra ID federated auth - SSRP instance lookup when instance_name is set - QueryResult::into_row_stream for streaming API - Row PartialEq impl - Named Pipes and Shared Memory transports - MultiSubnetFailover support - TDS 8.0 Strict encryption support - IntN/FltN column type resolution fix
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.
Replaces the
tiberiusTDS driver withmssql-tiberius-bridge— a tiberius-compatible API facade over Microsoft's officialmssql-tdsRust implementation.Closes #171
What changed
Cargo.tomltiberius+tokio-util→mssql-tiberius-bridge = "=0.1.0-preview.1"(crates.io)pool.rsTiberiusManager→BridgeManager— custom deadpool Manager pooling bridgeClientobjects. Eliminates manualTcpStream+compat_write()boilerplatepool_manager.rsTiberiusManager→BridgeManager)extract/mod.rstiberius::ColumnType→ bridgeColumnType, adjustedFromSqlpatternsintrospection.rsinto_first_result()is now sync (no second.await)mod.rsWhat didn't change
version.rs,helpers.rs,extract/temporal.rs— pure functions, no driver depsWhy
tiberiusis community-maintained with infrequent updatesmssql-tdsis Microsoft's official, actively developed TDS implementationClient,Row,Config,query(),simple_query(),into_first_result(),FromSql/ToSql), making this a mechanical migrationTest results
cargo clippy— zero warningscargo check— cleanKnown limitation
execute()returns 0 for DML — upstreammssql-tdsdoesn't expose DONE token row counts yet. No impact on Phase 1 (read-only). Tracked in mssql-tiberius-bridge#1.