This commit is contained in:
Steven Fackler 2022-07-18 20:18:18 -04:00
parent 09e86560dd
commit d7b10f2cea
No known key found for this signature in database
GPG Key ID: 30A04EB23B15B465
2 changed files with 7 additions and 13 deletions

View File

@ -836,7 +836,9 @@ pub trait ToSql: fmt::Debug {
) -> Result<IsNull, Box<dyn Error + Sync + Send>>;
/// Specify the encode format
fn encode_format(&self) -> Format { Format::Binary }
fn encode_format(&self) -> Format {
Format::Binary
}
}
/// Supported Postgres message format types
@ -849,17 +851,6 @@ pub enum Format {
Binary,
}
/// Convert from `Format` to the Postgres integer representation of those formats
impl From<Format> for i16 {
fn from(format: Format) -> Self {
match format {
Format::Text => 0,
Format::Binary => 1,
}
}
}
impl<'a, T> ToSql for &'a T
where
T: ToSql,

View File

@ -156,7 +156,10 @@ where
I: IntoIterator<Item = P>,
I::IntoIter: ExactSizeIterator,
{
let (param_formats, params):(Vec<_>, Vec<_>) = params.into_iter().map(|p|->(i16, P){(p.borrow_to_sql().encode_format().into(),p)}).unzip();
let (param_formats, params): (Vec<_>, Vec<_>) = params
.into_iter()
.map(|p| { (p.borrow_to_sql().encode_format() as i16, p) })
.unzip();
let params = params.into_iter();
assert!(