fix: Option decoding in any driver (#3172)

This commit is contained in:
Pmarquez 2024-04-20 00:46:03 +02:00 committed by GitHub
parent 17d832b3de
commit ceac70f7fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ pub enum AnyTypeInfoKind {
impl TypeInfo for AnyTypeInfo {
fn is_null(&self) -> bool {
false
self.kind == Null
}
fn name(&self) -> &str {

View File

@ -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)
}
}

View File

@ -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)
}
}