fix(sql): decode float columns as f32, closes #602 (#607)

This commit is contained in:
Fabian-Lars
2023-09-20 07:30:12 +02:00
committed by GitHub
parent 76832e60bf
commit 5b85dd22c7
+8 -1
View File
@@ -17,7 +17,14 @@ pub(crate) fn to_json(v: MySqlValueRef) -> Result<JsonValue, Error> {
JsonValue::Null
}
}
"FLOAT" | "DOUBLE" => {
"FLOAT" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f32>() {
JsonValue::from(v)
} else {
JsonValue::Null
}
}
"DOUBLE" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f64>() {
JsonValue::from(v)
} else {