macro_rules! db_column_to_string {
($row:expr, $index:expr) => { ... };
}Expand description
Render one column of one row as the string the profiler ingests.
The profiler consumes columns as Vec<String> and re-infers types from the
textual form, so every SQL type has to be turned into a faithful string.
sqlx offers no backend-agnostic “decode as whatever this is” call, so we try
concrete types in order and take the first that decodes.
Order is load-bearing:
Option<String>first. sqlx skips the type-compatibility check when the value is NULL, so a NULL of any SQL type decodes here asOk(None). That makes this arm the NULL detector as well as the text arm; everything below it is known to be a non-null value.- Integers before
bool. SQLite stores booleans as INTEGER and will happily decode42astrue, so tryingboolearly would render integers as “true”/“false”. - Widest integer first, so an INT8/BIGINT is not truncated by a narrower arm.
A value whose type matches none of these arms (NUMERIC/DECIMAL, dates and
times without the corresponding sqlx feature, BLOB) yields None and is
recorded as a null, which is the pre-existing behaviour for those types.