Skip to main content

Module value_text

Module value_text 

Source
Expand description

A value written as text reads the same on every engine.

Razeri writes values as text in two places a reader compares across engines: a load that refuses its rows names the values it refused, and a reconciliation writes each measurement as text so it can be compared with the source’s by string equality. An engine’s plain cast to text is not enough for either. Some engines write a date by a format the session sets, some drop a decimal’s trailing zeros, some write every digit of a timestamp’s declared precision, some write a zoned moment in the session’s zone, a floating ten as 10.0 or a truth value as 1. CanonicalText says what the text is for each type, and ExpressionRenderer::render_value_text is how an engine writes it.

Structs§

FloatArithmetic
How an engine with no printf spells the arithmetic computed_float_text does. Each closure is handed the SQL of its operand.
FloatParts
The pieces of a floating number’s text an engine computes for float_text, each an expression over the value’s magnitude.
TextFunctions
How an engine spells the text functions float_text uses. Each closure is handed the SQL of its operand.
ValueTextFunctions
The functions an engine writes a value’s text through, as ExpressionRenderer::value_text_functions answers them.

Enums§

CanonicalText
What a value’s text is, by its type.

Constants§

DOUBLE_DIGITS
The significant digits a double is written with: the most a decimal keeps through a double and back (C’s DBL_DIG).
FLOAT_TEXT_FUNCTION
The function an engine with no printf writes a double’s text through: fifteen significant digits, as %.15g writes them.
SINGLE_DIGITS
The significant digits a single-precision number is written with: the most a decimal keeps through one and back (C’s FLT_DIG).
SINGLE_FLOAT_TEXT_FUNCTION
The function an engine with no printf writes a single-precision number’s text through: six significant digits, as %.6g writes them.
UTC_OFFSET
What a zoned moment’s text ends with: its offset from UTC, which is none.

Functions§

computed_float_text
A floating number as %.{significant}g writes it, computed on an engine with no printf.
float_text
A floating number’s magnitude laid out as %.{significant}g lays it out, from the pieces an engine computed.
float_text_function
Which function writes a floating number rounded to significant digits: SINGLE_FLOAT_TEXT_FUNCTION for SINGLE_DIGITS, and FLOAT_TEXT_FUNCTION for every other count.
in_short_lines
An expression laid out one WHEN to a line, so a function body built from computed_float_text reads in a terminal and reaches the engine through a client that misreads a very long line.
rtrim_fraction
A timestamp written with six digits of fraction, with the trailing zeros and then a bare point removed, on an engine whose RTRIM takes the characters to remove.
signed_float_text
A floating number’s text from its magnitude’s: NULL for NULL, 0 for a zero of either sign, and a minus sign before a negative value’s magnitude.
truth_text
A truth value as true or false, on an engine that takes the value itself as a condition.