Skip to content
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
26 changes: 25 additions & 1 deletion src/tds/codec/column_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use super::{Encode, FixedLenType, TypeInfo, VarLenType};
use crate::tds::time::{Date, DateTime2, DateTimeOffset, Time};
use crate::{
tds::{time::DateTime, time::SmallDateTime, xml::XmlData, Numeric},
SqlReadBytes,
FromSql, FromSqlOwned, IntoSql, SqlReadBytes, ToSql,
};
use bytes::BufMut;
pub(crate) use bytes_mut_with_type_info::BytesMutWithTypeInfo;
Expand Down Expand Up @@ -689,6 +689,30 @@ impl<'a> Encode<BytesMutWithTypeInfo<'a>> for ColumnData<'a> {
}
}

impl<'a> FromSql<'a> for ColumnData<'a> {
fn from_sql(value: &'a ColumnData<'a>) -> crate::Result<Option<Self>> {
Ok(Some(value.clone()))
}
}

impl<'a> FromSqlOwned for ColumnData<'a> {
fn from_sql_owned(value: ColumnData<'a>) -> crate::Result<Option<Self>> {
Ok(Some(value))
}
}

impl<'a> ToSql for ColumnData<'a> {
fn to_sql(&self) -> ColumnData<'a> {
self.clone()
}
}

impl<'a> IntoSql<'a> for ColumnData<'a> {
fn into_sql(self) -> ColumnData<'a> {
self
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down