pub struct TdsVersion(/* private fields */);Expand description
TDS protocol version.
Represents the version of the TDS protocol used for communication with SQL Server.
Implementations§
Source§impl TdsVersion
impl TdsVersion
Sourcepub const fn requires_prelogin_encryption_negotiation(self) -> bool
pub const fn requires_prelogin_encryption_negotiation(self) -> bool
Check if this version requires pre-login encryption negotiation.
TDS 7.x versions negotiate encryption during pre-login. TDS 8.0 requires TLS before any TDS traffic.
Sourcepub const fn is_tds_7_3(self) -> bool
pub const fn is_tds_7_3(self) -> bool
Check if this version is TDS 7.3 (SQL Server 2008/2008 R2).
Returns true for both TDS 7.3A (SQL Server 2008) and TDS 7.3B (SQL Server 2008 R2).
Sourcepub const fn is_tds_7_4(self) -> bool
pub const fn is_tds_7_4(self) -> bool
Check if this version is TDS 7.4 (SQL Server 2012+).
Sourcepub const fn supports_date_time_types(self) -> bool
pub const fn supports_date_time_types(self) -> bool
Check if this version supports DATE, TIME, DATETIME2, and DATETIMEOFFSET types.
These types were introduced in TDS 7.3 (SQL Server 2008). Returns true for TDS 7.3+, TDS 7.4, and TDS 8.0.
Sourcepub const fn supports_session_recovery(self) -> bool
pub const fn supports_session_recovery(self) -> bool
Check if this version supports session recovery (connection resiliency).
Session recovery was introduced in TDS 7.4 (SQL Server 2012).
Sourcepub const fn supports_column_encryption(self) -> bool
pub const fn supports_column_encryption(self) -> bool
Check if this version supports column encryption (Always Encrypted).
Column encryption was introduced in SQL Server 2016 (still TDS 7.4). This checks protocol capability, not SQL Server version.
Sourcepub const fn supports_utf8(self) -> bool
pub const fn supports_utf8(self) -> bool
Check if this version supports UTF-8 (introduced in SQL Server 2019).
Sourcepub const fn is_legacy(self) -> bool
pub const fn is_legacy(self) -> bool
Check if this is a legacy version (TDS 7.2 or earlier).
Legacy versions (SQL Server 2005 and earlier) have different behaviors for some protocol aspects. This driver’s minimum supported version is TDS 7.3 for full functionality.
Sourcepub const fn min(self, other: Self) -> Self
pub const fn min(self, other: Self) -> Self
Get the minimum version between this version and another.
Useful for version negotiation where the client and server agree on the lowest common version.
Note: TDS 8.0 uses a different encoding (0x08000000) which is numerically lower than TDS 7.x versions, but semantically higher. This method handles that special case correctly.
Sourcepub const fn sql_server_version_name(&self) -> &'static str
pub const fn sql_server_version_name(&self) -> &'static str
Get the SQL Server version name for this TDS version.
Returns a human-readable string describing the SQL Server version that corresponds to this TDS protocol version.
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a TDS version from a string representation.
Accepts formats like:
- “7.3”, “7.3A”, “7.3a”, “7.3B”, “7.3b” for TDS 7.3
- “7.4” for TDS 7.4
- “8.0”, “8” for TDS 8.0
Returns None if the string cannot be parsed.
Sourcepub const fn major(self) -> u8
pub const fn major(self) -> u8
Get the major version number.
Returns 7 for TDS 7.x versions, 8 for TDS 8.0.
Note: This extracts the major version from the wire format. All TDS 7.x versions return 7, and TDS 8.0 returns 8.
Sourcepub const fn minor(self) -> u8
pub const fn minor(self) -> u8
Get the minor version number.
Returns the TDS sub-version: 0, 1, 2, 3, or 4 for TDS 7.x, and 0 for TDS 8.0.
Note: The wire format uses different encoding for different versions. This method extracts the logical minor version (e.g., 3 for TDS 7.3).
Sourcepub const fn revision_suffix(self) -> Option<char>
pub const fn revision_suffix(self) -> Option<char>
Get the revision suffix for TDS 7.3 versions.
Returns Some(‘A’) for TDS 7.3A (SQL Server 2008), Some(‘B’) for TDS 7.3B (SQL Server 2008 R2), and None for all other versions.
Trait Implementations§
Source§impl Clone for TdsVersion
impl Clone for TdsVersion
Source§fn clone(&self) -> TdsVersion
fn clone(&self) -> TdsVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more