Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Do not return error on 0000-00-00 date #419

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 1 addition & 6 deletions src/connector/mysql/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,7 @@ impl TakeRow for my::Row {
#[cfg(feature = "chrono")]
my::Value::Date(year, month, day, hour, min, sec, micro) => {
if day == 0 || month == 0 {
let msg = format!(
"The column `{}` contained an invalid datetime value with either day or month set to zero.",
column.name_str()
);
let kind = ErrorKind::value_out_of_range(msg);
return Err(Error::builder(kind).build());
return Ok(Value::DateTime(None));
}

let time = NaiveTime::from_hms_micro_opt(hour.into(), min.into(), sec.into(), micro).unwrap();
Expand Down