#[repr(u8)]pub enum TypeId {
Show 43 variants
Null = 31,
Int1 = 48,
Bit = 50,
Int2 = 52,
Int4 = 56,
Int8 = 127,
DateTimeN = 111,
Float4 = 59,
Float8 = 62,
Money = 60,
Money4 = 122,
DateTime = 61,
DateTime4 = 58,
Guid = 36,
IntN = 38,
Decimal = 55,
Numeric = 63,
BitN = 104,
DecimalN = 106,
NumericN = 108,
FloatN = 109,
MoneyN = 110,
Char = 47,
VarChar = 39,
Binary = 45,
VarBinary = 37,
BigVarChar = 167,
BigVarBinary = 165,
BigChar = 175,
BigBinary = 173,
NChar = 239,
NVarChar = 231,
Text = 35,
Image = 34,
NText = 99,
Date = 40,
Time = 41,
DateTime2 = 42,
DateTimeOffset = 43,
Variant = 98,
Udt = 240,
Xml = 241,
Tvp = 243,
}Expand description
TDS data type identifiers.
These correspond to the type bytes sent in column metadata and parameter definitions.
Variants§
Null = 31
Null type.
Int1 = 48
8-bit signed integer.
Bit = 50
Bit (boolean).
Int2 = 52
16-bit signed integer.
Int4 = 56
32-bit signed integer.
Int8 = 127
64-bit signed integer.
DateTimeN = 111
4-byte datetime.
Float4 = 59
32-bit floating point.
Float8 = 62
64-bit floating point.
Money = 60
8-byte money.
Money4 = 122
4-byte money.
DateTime = 61
4-byte datetime.
DateTime4 = 58
4-byte small datetime.
Guid = 36
Variable-length GUID.
IntN = 38
Variable-length integer.
Decimal = 55
Variable-length decimal.
Numeric = 63
Variable-length numeric.
BitN = 104
Variable-length bit.
DecimalN = 106
Variable-length decimal (newer).
NumericN = 108
Variable-length numeric (newer).
FloatN = 109
Variable-length float.
MoneyN = 110
Variable-length money.
Char = 47
Fixed-length character.
VarChar = 39
Variable-length character.
Binary = 45
Fixed-length binary.
VarBinary = 37
Variable-length binary.
BigVarChar = 167
Large variable-length character.
BigVarBinary = 165
Large variable-length binary.
BigChar = 175
Large fixed-length character.
BigBinary = 173
Large fixed-length binary.
NChar = 239
Fixed-length Unicode character.
NVarChar = 231
Variable-length Unicode character.
Text = 35
Text (deprecated, use varchar(max)).
Image = 34
Image (deprecated, use varbinary(max)).
NText = 99
NText (deprecated, use nvarchar(max)).
Date = 40
Date (3 bytes).
Time = 41
Time with variable precision.
DateTime2 = 42
DateTime2 with variable precision.
DateTimeOffset = 43
DateTimeOffset with variable precision.
Variant = 98
SQL Variant.
Udt = 240
User-defined type.
Xml = 241
XML type.
Tvp = 243
Table-valued parameter.
Implementations§
Source§impl TypeId
impl TypeId
Sourcepub const fn is_fixed_length(&self) -> bool
pub const fn is_fixed_length(&self) -> bool
Check if this is a fixed-length type.
Sourcepub const fn is_variable_length(&self) -> bool
pub const fn is_variable_length(&self) -> bool
Check if this is a variable-length type.
Sourcepub const fn is_plp(&self) -> bool
pub const fn is_plp(&self) -> bool
Check if this type always uses PLP (Partially Length-Prefixed) encoding.
Note: NVarChar, BigVarChar, and BigVarBinary also use PLP encoding
when declared as MAX types (max_length == 0xFFFF). This function only
returns true for types that always use PLP.
Sourcepub const fn can_be_max(&self) -> bool
pub const fn can_be_max(&self) -> bool
Check if this type can use PLP encoding when declared as MAX.
Returns true for types that use PLP when max_length == 0xFFFF:
- NVARCHAR(MAX)
- VARCHAR(MAX)
- VARBINARY(MAX)
Sourcepub const fn is_unicode(&self) -> bool
pub const fn is_unicode(&self) -> bool
Check if this is a Unicode type.
Sourcepub const fn is_datetime(&self) -> bool
pub const fn is_datetime(&self) -> bool
Check if this is a date/time type.
Sourcepub const fn fixed_size(&self) -> Option<usize>
pub const fn fixed_size(&self) -> Option<usize>
Get the fixed size of this type in bytes, if applicable.