fix(sql): Encode JSON numbers as f64 to fix JSON_EXTRACT queries (#797)

Signed-off-by: Mitchell van der Hoeff <8631205+mitchelljustin@users.noreply.github.com>
This commit is contained in:
Mitchell van der Hoeff
2023-12-06 09:20:35 -05:00
committed by GitHub
parent 0e3e3d4eac
commit f4b2674fd5
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -211,6 +211,8 @@ async fn execute(
query = query.bind(None::<JsonValue>);
} else if value.is_string() {
query = query.bind(value.as_str().unwrap().to_owned())
} else if let Some(number) = value.as_number() {
query = query.bind(number.as_f64().unwrap_or_default())
} else {
query = query.bind(value);
}
@@ -240,6 +242,8 @@ async fn select(
query = query.bind(None::<JsonValue>);
} else if value.is_string() {
query = query.bind(value.as_str().unwrap().to_owned())
} else if let Some(number) = value.as_number() {
query = query.bind(number.as_f64().unwrap_or_default())
} else {
query = query.bind(value);
}