mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
fix: Option decoding in any driver (#3172)
This commit is contained in:
parent
17d832b3de
commit
ceac70f7fa
@ -31,7 +31,7 @@ pub enum AnyTypeInfoKind {
|
||||
|
||||
impl TypeInfo for AnyTypeInfo {
|
||||
fn is_null(&self) -> bool {
|
||||
false
|
||||
self.kind == Null
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
|
||||
@ -92,7 +92,7 @@ impl Value for AnyValue {
|
||||
}
|
||||
|
||||
fn is_null(&self) -> bool {
|
||||
false
|
||||
matches!(self.kind, AnyValueKind::Null)
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,6 +120,6 @@ impl<'a> ValueRef<'a> for AnyValueRef<'a> {
|
||||
}
|
||||
|
||||
fn is_null(&self) -> bool {
|
||||
false
|
||||
matches!(self.kind, AnyValueKind::Null)
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
//! An `Option<T>` represents a potentially `NULL` value from SQL.
|
||||
//!
|
||||
|
||||
use crate::database::Database;
|
||||
use crate::{database::Database, type_info::TypeInfo};
|
||||
|
||||
#[cfg(feature = "bstr")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "bstr")))]
|
||||
@ -234,6 +234,6 @@ impl<T: Type<DB>, DB: Database> Type<DB> for Option<T> {
|
||||
}
|
||||
|
||||
fn compatible(ty: &DB::TypeInfo) -> bool {
|
||||
<T as Type<DB>>::compatible(ty)
|
||||
ty.is_null() || <T as Type<DB>>::compatible(ty)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user