Expand description
TDS binary encoding for SQL values.
This module provides encoding of Rust values into TDS wire format for transmission to SQL Server.
Traits§
- TdsEncode
- Trait for encoding values to TDS binary format.
Functions§
- datetime_
to_ legacy_ days_ ticks - Convert a NaiveDateTime to the DATETIME wire representation.
- datetime_
to_ smalldatetime_ days_ minutes - Convert a NaiveDateTime to the SMALLDATETIME wire representation.
- decimal_
to_ money_ cents_ i64 - Convert a decimal to the scaled i64 used on the MONEY wire.
- decimal_
to_ smallmoney_ cents_ i32 - Convert a decimal to the scaled i32 used on the SMALLMONEY wire.
- encode_
date - Encode a DATE value.
- encode_
datetime2 - Encode a DATETIME2 value.
- encode_
datetime_ legacy - Encode a DATETIME value (8 bytes): days since 1900 (
i32LE) + time units since midnight (u32LE) where each unit is 1/300 of a second. - encode_
datetimeoffset - Encode a DATETIMEOFFSET value.
- encode_
decimal - Encode a decimal value.
- encode_
money - Encode a decimal as MONEY (8 bytes): the signed 64-bit scaled integer is written as the high 32 bits LE followed by the low 32 bits LE, per MS-TDS §2.2.5.5.1.2.
- encode_
smalldatetime - Encode a SMALLDATETIME value (4 bytes): days since 1900 (
u16LE) + minutes since midnight (u16LE). Seconds are rounded to the nearest minute (30s rounds up per SQL Server semantics). - encode_
smallmoney - Encode a decimal as SMALLMONEY (4 bytes): the signed 32-bit scaled integer is written little-endian.
- encode_
time - Encode a TIME value.
- encode_
utf16_ string - Encode a string as UTF-16LE with length prefix.
- encode_
utf16_ string_ no_ len - Encode a string as UTF-16LE without length prefix (for fixed-length fields).
- encode_
uuid - Encode a UUID in SQL Server’s mixed-endian format.