mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
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:
committed by
GitHub
parent
0e3e3d4eac
commit
f4b2674fd5
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user