Skip to content

Commit

Permalink
fix(sql): decode float columns as f32, closes #602 (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Sep 20, 2023
1 parent 76832e6 commit 5b85dd2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/sql/src/decode/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5b85dd2

Please sign in to comment.