mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 15:55:45 +00:00
Fix Option for Any driver. (#1661)
With macro impl_encode_for_option Null values are not added, when creating arguments for the actual driver selected at runtime.
This commit is contained in:
parent
6674e8ba96
commit
160f345f4f
@ -61,4 +61,26 @@ impl_column_index_for_statement!(AnyStatement);
|
|||||||
impl_into_maybe_pool!(Any, AnyConnection);
|
impl_into_maybe_pool!(Any, AnyConnection);
|
||||||
|
|
||||||
// required because some databases have a different handling of NULL
|
// required because some databases have a different handling of NULL
|
||||||
impl_encode_for_option!(Any);
|
impl<'q, T> crate::encode::Encode<'q, Any> for Option<T>
|
||||||
|
where
|
||||||
|
T: AnyEncode<'q> + 'q,
|
||||||
|
{
|
||||||
|
fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> crate::encode::IsNull {
|
||||||
|
match &mut buf.0 {
|
||||||
|
#[cfg(feature = "postgres")]
|
||||||
|
arguments::AnyArgumentBufferKind::Postgres(args, _) => args.add(self),
|
||||||
|
|
||||||
|
#[cfg(feature = "mysql")]
|
||||||
|
arguments::AnyArgumentBufferKind::MySql(args, _) => args.add(self),
|
||||||
|
|
||||||
|
#[cfg(feature = "mssql")]
|
||||||
|
arguments::AnyArgumentBufferKind::Mssql(args, _) => args.add(self),
|
||||||
|
|
||||||
|
#[cfg(feature = "sqlite")]
|
||||||
|
arguments::AnyArgumentBufferKind::Sqlite(args) => args.add(self),
|
||||||
|
}
|
||||||
|
|
||||||
|
// unused
|
||||||
|
crate::encode::IsNull::No
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user