sqlx-sqlserver
Independent Microsoft SQL Server driver crate for SQLx.
This crate is a standalone top-level crate. It depends only on crates published
to crates.io and is not wired into the sqlx facade crate, so examples use
sqlx-core directly.
Minimal Query
[]
= "0.0.5"
= "=0.9.0"
= { = "1", = ["macros", "rt"] }
use ;
use Row;
use MssqlConnectOptions;
async
Use fetch to read rows as SQL Server sends them. Dropping the stream between
rows leaves the connection available for reuse. Before sending the next query,
the driver drains the rest of the batch and applies its transaction changes.
fetch_one and fetch_optional read to the end of the batch so they can report
an error that follows the first row.
Any Driver
Install this crate explicitly before opening SQL Server URLs through SQLx
AnyConnection:
use Connection;
install_drivers?;
let mut conn = connect
.await?;
For local development, run fast tests with ./scripts/ci.sh. Run e2e tests
with MSSQL_DATABASE_URL=... ./scripts/test-mssql.sh.