rustlavel_db/sqlserver/mod.rs
1//! The SQL Server driver, implemented directly on TDS 7.4.
2//!
3//! TDS — the Tabular Data Stream — is written here from Microsoft's published
4//! MS-TDS specification: the packet framing, the pre-login exchange, LOGIN7,
5//! SQLBatch, RPC and the token stream that comes back. Nothing is borrowed from
6//! an existing client, and nothing goes through ODBC.
7//!
8//! Three things separate this from the PostgreSQL driver next door:
9//!
10//! * **Encryption is negotiated inside the handshake.** The TLS records are
11//! tunnelled through TDS packets until the handshake completes. [`auth`]
12//! documents that in full, because it is the part that surprises everyone.
13//! * **Parameters travel as arguments to a stored procedure.** Every
14//! parameterised statement is sent as an RPC call to `sp_executesql`, with
15//! the statement text and a declaration list as its first two arguments. A
16//! bound value is never part of the SQL text, so it can never become SQL.
17//! * **Values arrive in binary.** [`types`] owns a decoder per type, where the
18//! PostgreSQL driver asks the server for text.
19//!
20//! # Authentication
21//!
22//! SQL Server authentication only — a username and a password. Windows
23//! integrated authentication (NTLM, Kerberos, SSPI) and Entra federated
24//! authentication are not implemented, and a server that demands one of them is
25//! told so by name.
26
27pub mod auth;
28pub mod connection;
29pub mod protocol;
30pub mod types;
31
32pub use auth::{Encryption, TlsOptions};
33pub use connection::{SqlServerConnection, SqlServerDriver, SqlServerOptions};