Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use fractionals in PS Datetimes #4426

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions query-engine/driver-adapters/src/conversion/mysql.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::conversion::JSArg;
use serde_json::value::Value as JsonValue;

const DATETIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
const DATETIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S%.f";
const DATE_FORMAT: &str = "%Y-%m-%d";
const TIME_FORMAT: &str = "%H:%M:%S";
const TIME_FORMAT: &str = "%H:%M:%S%.f";

#[rustfmt::skip]
pub fn value_to_js_arg(value: &quaint::Value) -> serde_json::Result<JSArg> {
Expand Down Expand Up @@ -66,16 +66,16 @@ mod test {
JSArg::Value(JsonValue::Null)
),
(
ValueType::DateTime(Some(Utc.with_ymd_and_hms(2020, 1, 1, 23, 13, 1).unwrap())),
JSArg::Value(JsonValue::String("2020-01-01 23:13:01".to_string()))
ValueType::DateTime(Some(Utc.with_ymd_and_hms(2020, 1, 1, 23, 13, 1).unwrap().with_nanosecond(100).unwrap())),
JSArg::Value(JsonValue::String("2020-01-01 23:13:01.000000100".to_string()))
),
(
ValueType::DateTime(None),
JSArg::Value(JsonValue::Null)
),
(
ValueType::Time(Some(NaiveTime::from_hms_opt(23, 13, 1).unwrap())),
JSArg::Value(JsonValue::String("23:13:01".to_string()))
ValueType::Time(Some(NaiveTime::from_hms_opt(23, 13, 1).unwrap().with_nanosecond(1200).unwrap())),
JSArg::Value(JsonValue::String("23:13:01.000001200".to_string()))
),
(
ValueType::Time(None),
Expand Down
Loading