pub fn convert_value(val: &Value) -> Result<SqlValue>Expand description
Convert a sqlparser Value to our SqlValue.
Number literal routing:
- Integers in
i64range →SqlValue::Int. - Larger integers →
SqlValue::Decimal, exact. Au64abovei64::MAXis theDecimalValue::from_u64gives it, so it is written as a msgpackuint64. An integer past theDecimalrange isSqlError::NumericLiteralOutOfRange: rounding it to a float would store another number than the one written. - Numbers with an exponent (
eorE) →SqlValue::Float. A bound float parameter renders in this form, so it stays a float. - Other numbers with
.→SqlValue::Decimal(exact arithmetic). - If decimal parse fails → fallback to
SqlValue::Float, thenSqlValue::String.