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

pull/609/head
Fabian-Lars 2 years ago committed by GitHub
parent 76832e60bf
commit 5b85dd22c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,14 @@ pub(crate) fn to_json(v: MySqlValueRef) -> Result<JsonValue, Error> {
JsonValue::Null 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>() { if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f64>() {
JsonValue::from(v) JsonValue::from(v)
} else { } else {

Loading…
Cancel
Save