1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3#![deny(unsafe_code)]
4
5pub mod blob;
21pub(crate) mod browser;
22pub mod bulk;
23pub mod cancel;
24pub mod change_tracking;
25pub mod client;
26#[cfg(feature = "always-encrypted")]
27pub(crate) mod column_decryptor;
28pub(crate) mod column_parser;
29pub mod config;
30pub mod encryption;
31pub mod error;
32#[cfg(all(windows, feature = "filestream"))]
33#[allow(unsafe_code)] pub mod filestream;
35pub mod from_row;
36pub mod instrumentation;
37pub mod procedure;
38pub mod query;
39pub mod row;
40pub mod state;
41pub(crate) mod statement_cache;
45pub mod stream;
46pub mod to_params;
47pub mod transaction;
48pub mod tvp;
49pub(crate) mod validation;
50
51pub use bulk::{
53 BulkColumn, BulkInsert, BulkInsertBuilder, BulkInsertResult, BulkOptions, BulkWriter,
54};
55pub use cancel::CancelHandle;
56pub use client::Client;
57pub use config::{ApplicationIntent, Config, RedirectConfig, RetryPolicy, TimeoutConfig};
58pub use error::{Error, SharedIoError};
59pub use mssql_auth::AuthError;
66pub use mssql_codec::CodecError;
67#[cfg(feature = "tls")]
68pub use mssql_tls::TlsError;
69pub use mssql_types::TypeError;
70pub use tds_protocol::ProtocolError;
71
72#[cfg(feature = "tls")]
76pub use mssql_tls::{CertificateDer, TlsConfig};
77
78#[cfg(feature = "always-encrypted")]
82pub use mssql_auth::KeyStoreProvider;
83
84pub use tds_protocol::token::Collation;
88
89#[cfg(feature = "derive")]
96pub use mssql_derive::{FromRow, ToParams, Tvp};
97
98#[doc(hidden)]
102pub mod __private {
103 pub use mssql_types::{ToSql, TypeError};
104}
105
106pub use from_row::{FromRow, MapRows, RowIteratorExt};
108pub use mssql_auth::Credentials;
109pub use tds_protocol::version::TdsVersion;
110
111#[cfg(feature = "zeroize")]
113pub use mssql_auth::{SecretString, SecureCredentials};
114pub use mssql_types::{
115 Binary, Char, EncryptedParamType, FromSql, NChar, SqlTyped, SqlValue, ToSql, TypedNull, binary,
116 char, nchar, null,
117};
118#[cfg(feature = "chrono")]
119pub use mssql_types::{
120 DateTime2, DateTimeLegacy, DateTimeOffset, SmallDateTime, Time, datetime, datetime2,
121 datetimeoffset, time,
122};
123#[cfg(feature = "decimal")]
124pub use mssql_types::{Money, Numeric, SmallMoney, numeric};
125pub use procedure::ProcedureBuilder;
126pub use query::in_params;
127pub use row::{Column, Row};
128pub use state::{
129 Connected, ConnectionState, Disconnected, InTransaction, ProtocolState, Ready, Streaming,
130};
131
132#[cfg(feature = "fuzzing")]
137#[doc(hidden)]
138pub mod __fuzzing {
139 pub use crate::column_parser::parse_column_value;
140}
141pub use stream::{
142 ExecuteResult, MultiResultStream, OutputParam, ProcedureResult, QueryStream, ResultSet,
143};
144pub use to_params::{NamedParam, ParamList, ToParams};
145pub use transaction::{IsolationLevel, SavePoint, Transaction};
146pub use tvp::{Tvp, TvpColumn, TvpRow, TvpValue};
147
148#[cfg(all(windows, feature = "filestream"))]
150pub use filestream::{FileStream, FileStreamAccess, open_options as filestream_options};
151
152#[cfg(feature = "always-encrypted")]
154pub use encryption::EncryptionContext;
155pub use encryption::{
156 EncryptionConfig, ParameterCryptoInfo, ParameterEncryptionInfo, ResultSetEncryptionInfo,
157};
158
159pub use instrumentation::{
161 DatabaseMetrics, OperationTimer, SanitizationConfig, attributes, metric_names, span_names,
162};
163
164pub use change_tracking::{
166 ChangeMetadata, ChangeOperation, ChangeTracking, ChangeTrackingQuery, SyncVersionStatus,
167};
168
169#[cfg(test)]
170mod auto_trait_tests {
171 use super::*;
178
179 fn assert_send<T: Send>() {}
180 fn assert_sync<T: Sync>() {}
181
182 #[test]
184 fn client_ready_is_send_sync() {
185 assert_send::<Client<Ready>>();
186 assert_sync::<Client<Ready>>();
187 }
188
189 #[test]
190 fn client_in_transaction_is_send_sync() {
191 assert_send::<Client<InTransaction>>();
192 assert_sync::<Client<InTransaction>>();
193 }
194
195 #[test]
196 fn client_disconnected_is_send_sync() {
197 assert_send::<Client<Disconnected>>();
198 assert_sync::<Client<Disconnected>>();
199 }
200
201 #[test]
202 fn client_connected_is_send_sync() {
203 assert_send::<Client<Connected>>();
204 assert_sync::<Client<Connected>>();
205 }
206
207 #[test]
208 fn client_streaming_is_send_sync() {
209 assert_send::<Client<Streaming>>();
210 assert_sync::<Client<Streaming>>();
211 }
212
213 #[test]
215 fn config_is_send_sync() {
216 assert_send::<Config>();
217 assert_sync::<Config>();
218 }
219
220 #[test]
222 fn query_stream_is_send_sync() {
223 assert_send::<QueryStream<'_>>();
224 assert_sync::<QueryStream<'_>>();
225 }
226
227 #[test]
228 fn multi_result_stream_is_send_sync() {
229 assert_send::<MultiResultStream<'_>>();
230 assert_sync::<MultiResultStream<'_>>();
231 }
232
233 #[test]
234 fn result_set_is_send_sync() {
235 assert_send::<ResultSet>();
236 assert_sync::<ResultSet>();
237 }
238
239 #[test]
240 fn execute_result_is_send_sync() {
241 assert_send::<ExecuteResult>();
242 assert_sync::<ExecuteResult>();
243 }
244
245 #[test]
246 fn procedure_result_is_send_sync() {
247 assert_send::<ProcedureResult>();
248 assert_sync::<ProcedureResult>();
249 }
250
251 #[test]
252 fn procedure_builder_is_send_sync() {
253 assert_send::<ProcedureBuilder<'_, Ready>>();
254 assert_sync::<ProcedureBuilder<'_, Ready>>();
255 }
256
257 #[test]
259 fn bulk_insert_is_send_sync() {
260 assert_send::<BulkInsert>();
261 assert_sync::<BulkInsert>();
262 }
263
264 #[test]
265 fn bulk_insert_builder_is_send_sync() {
266 assert_send::<BulkInsertBuilder>();
267 assert_sync::<BulkInsertBuilder>();
268 }
269
270 #[test]
271 fn bulk_options_is_send_sync() {
272 assert_send::<BulkOptions>();
273 assert_sync::<BulkOptions>();
274 }
275
276 #[test]
278 fn cancel_handle_is_send_sync() {
279 assert_send::<CancelHandle>();
280 assert_sync::<CancelHandle>();
281 }
282
283 #[test]
285 fn row_is_send_sync() {
286 assert_send::<Row>();
287 assert_sync::<Row>();
288 }
289
290 #[test]
291 fn column_is_send_sync() {
292 assert_send::<Column>();
293 assert_sync::<Column>();
294 }
295
296 #[test]
298 fn statement_cache_is_send_sync() {
299 use crate::statement_cache::StatementCache;
300 assert_send::<StatementCache>();
301 assert_sync::<StatementCache>();
302 }
303
304 #[test]
306 fn error_is_send_sync() {
307 assert_send::<Error>();
308 assert_sync::<Error>();
309 }
310}