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 V7_0: TdsVersion
pub const V7_0: TdsVersion
TDS 7.0 (SQL Server 7.0)
Sourcepub const V7_1: TdsVersion
pub const V7_1: TdsVersion
TDS 7.1 (SQL Server 2000)
Sourcepub const V7_1_REV1: TdsVersion
pub const V7_1_REV1: TdsVersion
TDS 7.1 Revision 1 (SQL Server 2000 SP1)
Sourcepub const V7_2: TdsVersion
pub const V7_2: TdsVersion
TDS 7.2 (SQL Server 2005)
Sourcepub const V7_3A: TdsVersion
pub const V7_3A: TdsVersion
TDS 7.3A (SQL Server 2008)
Sourcepub const V7_3B: TdsVersion
pub const V7_3B: TdsVersion
TDS 7.3B (SQL Server 2008 R2)
Sourcepub const V7_4: TdsVersion
pub const V7_4: TdsVersion
TDS 7.4 (SQL Server 2012+)
Sourcepub const V8_0: TdsVersion
pub const V8_0: TdsVersion
TDS 8.0 (SQL Server 2022+ strict encryption mode)
Sourcepub const fn new(version: u32) -> TdsVersion
pub const fn new(version: u32) -> TdsVersion
Create a new TDS version from raw bytes.
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: TdsVersion) -> TdsVersion
pub const fn min(self, other: TdsVersion) -> TdsVersion
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<TdsVersion>
pub fn parse(s: &str) -> Option<TdsVersion>
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 moreSource§impl Debug for TdsVersion
impl Debug for TdsVersion
Source§impl Default for TdsVersion
impl Default for TdsVersion
Source§fn default() -> TdsVersion
fn default() -> TdsVersion
Source§impl Display for TdsVersion
impl Display for TdsVersion
Source§impl From<u32> for TdsVersion
impl From<u32> for TdsVersion
Source§fn from(value: u32) -> TdsVersion
fn from(value: u32) -> TdsVersion
Source§impl Hash for TdsVersion
impl Hash for TdsVersion
Source§impl Ord for TdsVersion
impl Ord for TdsVersion
Source§fn cmp(&self, other: &TdsVersion) -> Ordering
fn cmp(&self, other: &TdsVersion) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TdsVersion
impl PartialEq for TdsVersion
Source§impl PartialOrd for TdsVersion
impl PartialOrd for TdsVersion
impl Copy for TdsVersion
impl Eq for TdsVersion
impl StructuralPartialEq for TdsVersion
Auto Trait Implementations§
impl Freeze for TdsVersion
impl RefUnwindSafe for TdsVersion
impl Send for TdsVersion
impl Sync for TdsVersion
impl Unpin for TdsVersion
impl UnwindSafe for TdsVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.