Expand description
MSSQL driver for SQLx via ODBC.
sqlx-mssql-odbc connects SQLx to Microsoft SQL Server through an ODBC driver
manager (unixODBC on Linux/macOS, built-in on Windows).
§Connection
use sqlx_core::connection::Connection;
use sqlx_core::row::Row;
use sqlx_mssql_odbc_core::MssqlConnection;
let mut conn = MssqlConnection::connect("mssql://sa:Password1!@localhost:1433/testdb").await?;
let row = sqlx_core::query::query("SELECT 1")
.fetch_one(&mut conn)
.await?;
let value: i32 = row.try_get(0)?;
assert_eq!(value, 1);
conn.close().await?;MssqlConnection::connect() accepts a standard mssql:// URL or a raw ODBC
connection string.
§Requirements
On Linux and macOS, install the unixODBC driver manager and the Microsoft ODBC Driver 17 or 18 for SQL Server. On Windows, the driver manager is built in, but the Microsoft ODBC Driver for SQL Server still needs to be installed.
Enable the vendored-unix-odbc feature to statically link the unixODBC
driver manager into your application on Linux or macOS.
Buffered fetching can improve throughput, but long text or binary values may
be truncated when max_column_size is set. Use unbuffered mode for values
that may exceed that limit.
Modules§
- type_
checking - Type-checking support for compile-time query macros.
Structs§
- Mssql
- MSSQL database marker for SQLx-core traits.
- Mssql
Arguments - Values that can be bound to MSSQL ODBC parameters.
- Mssql
Buffer Settings - Fetch-buffer settings used by the MSSQL ODBC driver.
- Mssql
Column - Column metadata for an MSSQL result set via ODBC.
- Mssql
Connect Options - Connection options for an MSSQL ODBC data source.
- Mssql
Connection - MSSQL connection backed by an actor thread that owns the ODBC connection.
- Mssql
Database Error - Database error details extracted from ODBC diagnostics.
- Mssql
Parameter Collection - Owned MSSQL ODBC parameter storage ready to bind with
odbc-api. - Mssql
Query Result - Result summary for an MSSQL query via ODBC.
- Mssql
Row - Minimal MSSQL row container used by the SQLx-core skeleton.
- Mssql
Statement - Prepared statement metadata for MSSQL via ODBC.
- Mssql
Transaction Manager - Transaction manager for MSSQL via ODBC.
- Mssql
Type Info - Type information for an MSSQL ODBC value.
- Mssql
Value - A small owned MSSQL ODBC value representation.
Enums§
- Mssql
Argument Value - Values that can currently be bound to MSSQL ODBC parameters.
- Mssql
Error - Error type returned by this crate.
- Mssql
Value Kind - Supported owned MSSQL ODBC value kinds.
Traits§
- Data
Type Ext - Helper predicates for
odbc-apidata type groups. - Mssql
Executor - An alias for
Executor<'_, Database = Mssql>.
Type Aliases§
- Mssql
Pool - An alias for
Pool, specialized for MSSQL. - Mssql
Pool Options - An alias for
PoolOptions, specialized for MSSQL. - Mssql
Transaction - An alias for
Transaction, specialized for MSSQL. - Result
- Result alias for this crate.