1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! Async Rust implementation of the TDS (Tabular Data Stream) protocol for SQL Server
//! and Azure SQL Database.
//!
//! # Overview
//!
//! `mssql-tds` provides a low-level, async client for communicating with SQL Server
//! using the TDS protocol. It handles connection negotiation (prelogin, TLS, login7),
//! query execution, result set streaming, bulk copy, RPC calls, and transaction
//! management.
//!
//! # Feature flags
//!
//! | Flag | Default | Description |
//! |------|---------|-------------|
//! | `integrated-auth` | **yes** | Enables both `sspi` and `gssapi` |
//! | `sspi` | via `integrated-auth` | Windows SSPI (Kerberos/NTLM) |
//! | `gssapi` | via `integrated-auth` | Unix GSSAPI (Kerberos) via runtime `dlopen` |
//!
//! Disable the default to drop platform-specific auth dependencies:
//!
//! ```toml
//! mssql-tds = { version = "0.1", default-features = false }
//! ```
//!
//! # Quick start
//!
//! ```rust,no_run
//! use mssql_tds::connection::client_context::ClientContext;
//! use mssql_tds::connection::tds_client::ResultSet;
//! use mssql_tds::connection_provider::tds_connection_provider::TdsConnectionProvider;
//! use mssql_tds::core::TdsResult;
//!
//! #[tokio::main]
//! async fn main() -> TdsResult<()> {
//! let mut context = ClientContext::default();
//! context.user_name = std::env::var("DB_USER").unwrap_or("<user>".into());
//! context.password = std::env::var("DB_PASSWORD").unwrap_or("<password>".into());
//! context.database = "master".into();
//!
//! let provider = TdsConnectionProvider {};
//! let mut client = provider
//! .create_client(context, "tcp:localhost,1433", None)
//! .await?;
//!
//! client.execute("SELECT 1 AS value".into(), ()).await?;
//!
//! if client.on_rows() {
//! while let Some(row) = client.next_row().await? {
//! println!("{row:?}");
//! }
//! }
//!
//! client.close_query().await?;
//! Ok(())
//! }
//! ```
//!
//! # Modules
//!
//! - [`connection`] — Client type ([`connection::tds_client::TdsClient`]),
//! connection context, and authentication configuration.
//! - [`connection_provider`] — Connection factory
//! ([`connection_provider::tds_connection_provider::TdsConnectionProvider`]).
//! - [`core`] — Shared types: [`core::TdsResult`], [`core::EncryptionOptions`],
//! [`core::CancelHandle`].
//! - [`cursor`] — Cursor types, bitflags, and response structs for `sp_cursor*` RPCs.
//! - [`datatypes`] — SQL Server data types and column value representations.
//! - [`error`] — Error definitions.
//! - [`message`] — TDS message types (prelogin, login7, etc.).
//! - [`query`] — Query metadata and column descriptors.
//! - [`token`] — TDS token stream parsing (COLMETADATA, ROW, DONE, etc.).
/// Shared types: result aliases, encryption settings, and cancellation.
// `EncodingType::encoding` and `lcid_to_encoding` hand out `&'static
// encoding_rs::Encoding`, so a consumer needs the exact same `encoding_rs` build
// to name the type. Re-exported so they inherit ours instead of guessing a
// matching version.
pub use encoding_rs;
/// Cursor types and response structures for TDS cursor RPCs.
/// Error definitions for TDS operations.
pub
pub
pub
pub
// Expose internal APIs for fuzzing
// Test-only helpers for driving a `TdsClient` from scripted TDS tokens. Gated
// behind `test-util` so downstream crates can unit-test client-driven paths.
// Test-only plumbing for feeding hand-built TDS packets to a real
// `NetworkTransport`. Spans `io` and `connection::transport`, so it belongs to
// neither.
pub