From 1f24eb46bbcc8c857d62cf7537807351463b8cf4 Mon Sep 17 00:00:00 2001 From: setenum Date: Sat, 13 Jul 2024 11:38:00 -0700 Subject: [PATCH] fix: bulk insert date token error --- src/tds/codec/type_info.rs | 4 ++-- tests/bulk.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tds/codec/type_info.rs b/src/tds/codec/type_info.rs index 0b9aa624..a0a626c3 100644 --- a/src/tds/codec/type_info.rs +++ b/src/tds/codec/type_info.rs @@ -71,8 +71,8 @@ impl Encode for VarLenContext { // length match self.r#type { #[cfg(feature = "tds73")] - VarLenType::Daten - | VarLenType::Timen + VarLenType::Daten => {} + VarLenType::Timen | VarLenType::DatetimeOffsetn | VarLenType::Datetime2 => { dst.put_u8(self.len() as u8); diff --git a/tests/bulk.rs b/tests/bulk.rs index fdf059d9..d4e1bc70 100644 --- a/tests/bulk.rs +++ b/tests/bulk.rs @@ -7,7 +7,7 @@ use std::sync::Once; use tiberius::{IntoSql, Result, TokenRow}; #[cfg(all(feature = "tds73", feature = "chrono"))] -use chrono::NaiveDateTime; +use chrono::{NaiveDateTime, NaiveDate}; use runtimes_macro::test_on_runtimes; @@ -192,3 +192,10 @@ test_bulk_type!(datetime2_7( 100, vec![NaiveDateTime::from_timestamp_opt(1658524194, 123456789).unwrap(); 100].into_iter() )); + +#[cfg(all(feature = "tds73", feature = "chrono"))] +test_bulk_type!(date( + "DATE", + 100, + vec![NaiveDate::from_ymd_opt(2020, 4, 20).unwrap(); 100].into_iter() +)); \ No newline at end of file