pub enum MysqlIntWidth {
Tiny,
Small,
Medium,
Int,
Big,
}Expand description
v7.39 (round 386, type-fidelity epic P1) — the declared MySQL narrow
integer type for a column whose storage DataType cannot express it.
MySQL TINYINT (i8, -128..127) collapses to DataType::SmallInt (i16)
and MEDIUMINT (24-bit) to DataType::Int (i32) — both wider than the
declared type, so a range check against ty alone accepts out-of-range
values (INSERT 128 INTO TINYINT is stored silently where MariaDB
strict raises ERROR 1264). This annotation records the lost width so the
write path (epic P2) can enforce the real bounds. SMALLINT / INT /
BIGINT need no marker — their storage DataType is already faithful.
Sparse: only TINYINT / MEDIUMINT columns carry it; persisted in the
FILE_VERSION 81+ appendix, older catalogs deserialise as None.
Variants§
Tiny
MySQL TINYINT — signed -128..127, unsigned 0..255. Storage i16.
Small
MySQL SMALLINT UNSIGNED — 0..65535. Storage widened to i32 (a
signed SMALLINT keeps DataType::SmallInt and carries no marker).
Medium
MySQL MEDIUMINT — signed -8388608..8388607, unsigned 0..16777215.
Storage i32.
Int
MySQL INT UNSIGNED — 0..4294967295. Storage widened to i64 (a
signed INT keeps DataType::Int and carries no marker).
Big
v7.39 (round 471, epic P4b) — MySQL BIGINT UNSIGNED —
0..18446744073709551615. i64 stops at 2^63-1, so the storage tag is
widened to Numeric (i128-backed, scale 0), which already compares,
orders, indexes and renders as an exact integer. A signed BIGINT
keeps DataType::BigInt and carries no marker.
Trait Implementations§
Source§impl Clone for MysqlIntWidth
impl Clone for MysqlIntWidth
Source§fn clone(&self) -> MysqlIntWidth
fn clone(&self) -> MysqlIntWidth
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more