File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -594,6 +594,20 @@ impl<'a> Encode<BytesMutWithTypeInfo<'a>> for ColumnData<'a> {
594
594
time. encode ( & mut * dst) ?;
595
595
}
596
596
#[ cfg( feature = "tds73" ) ]
597
+ ( ColumnData :: DateTime2 ( opt) , Some ( TypeInfo :: VarLenSized ( vlc) ) )
598
+ if vlc. r#type ( ) == VarLenType :: Datetimen =>
599
+ {
600
+ if let Some ( dt2) = opt {
601
+ dst. put_u8 ( 8 ) ;
602
+ let days = dt2. date ( ) . days ( ) - 693595 ; // minus days gap between year 1 and year 1900;
603
+ let seconds_fragments = dt2. time ( ) . increments ( ) * 100 * 300 / 1e9 as u64 ; // degrade second's precision
604
+ dst. put_u32_le ( days as u32 ) ;
605
+ dst. put_u32_le ( seconds_fragments as u32 ) ;
606
+ } else {
607
+ dst. put_u8 ( 0 ) ;
608
+ }
609
+ }
610
+ #[ cfg( feature = "tds73" ) ]
597
611
( ColumnData :: DateTime2 ( opt) , Some ( TypeInfo :: VarLenSized ( vlc) ) )
598
612
if vlc. r#type ( ) == VarLenType :: Datetime2 =>
599
613
{
You can’t perform that action at this time.
0 commit comments