Enum odbc_api::buffers::BufferKind [−][src]
This class is used together with crate::buffers::BufferDescription to specify the layout of
buffers bound to ODBC cursors and statements.
Variants
Variable sized binary buffer, holding up to length bytes per value.
Fields of Binary
length: usizeMaximum number of bytes per value.
Text buffer holding strings with binary length of up to max_str_len.
Fields of Text
max_str_len: usizeMaximum string length. Terminating zero is excluded, i.e. memory for it will be implicitly allocated if required.
UTF-16 encoded text buffer holding strings with length of up to max_str_len. Length is in
terms of 2-Byte characters.
Fields of WText
max_str_len: usizeMaximum string length. Terminating zero is excluded, i.e. memory for it will be implicitly allocated if required.
64 bit floating point
32 bit floating point
Describes a buffer holding crate::sys::Date values.
Describes a buffer holding crate::sys::Time values.
Describes a buffer holding crate::sys::Timestamp values.
Signed 8 Bit integer
Signed 16 Bit integer
Signed 32 Bit integer
Signed 64 Bit integer
Unsigned 8 Bit integer
Can either be zero or one
Implementations
impl BufferKind[src]
pub fn from_data_type(data_type: DataType) -> Option<Self>[src]
Describe a buffer which fits best the SQL Data Type.
use odbc_api::{DataType, buffers::BufferKind}; assert_eq!(BufferKind::from_data_type(DataType::Unknown), None); assert_eq!( BufferKind::from_data_type(DataType::Numeric { precision: 2, scale: 0 }), Some(BufferKind::I8) ); assert_eq!( BufferKind::from_data_type(DataType::Numeric { precision: 9, scale: 0 }), Some(BufferKind::I32) ); assert_eq!( BufferKind::from_data_type(DataType::Numeric { precision: 18, scale: 0 }), Some(BufferKind::I64) ); assert_eq!( BufferKind::from_data_type(DataType::Numeric { precision: 20, scale: 5 }), Some(BufferKind::Text { max_str_len: 20 + 2 }) ); assert_eq!( BufferKind::from_data_type(DataType::Varchar { length: 42 }), Some(BufferKind::Text { max_str_len: 42 }) ); // We do not care about the encoding in the datasource. WVarchar is mapped to `Text`, too // (instead of `WText`). assert_eq!( BufferKind::from_data_type(DataType::WVarchar { length: 42 }), Some(BufferKind::Text { max_str_len: 42 }) ); assert_eq!( BufferKind::from_data_type(DataType::BigInt), Some(BufferKind::I64) ); assert_eq!( BufferKind::from_data_type(DataType::Integer), Some(BufferKind::I32) ); assert_eq!( BufferKind::from_data_type(DataType::SmallInt), Some(BufferKind::I16) ); assert_eq!( BufferKind::from_data_type(DataType::TinyInt), Some(BufferKind::I8) ); assert_eq!( BufferKind::from_data_type(DataType::Float), Some(BufferKind::F32) ); assert_eq!( BufferKind::from_data_type(DataType::Double), Some(BufferKind::F64) ); assert_eq!( BufferKind::from_data_type(DataType::Date), Some(BufferKind::Date) ); assert_eq!( BufferKind::from_data_type(DataType::Time { precision: 0 }), Some(BufferKind::Time) ); assert_eq!( BufferKind::from_data_type(DataType::Bit), Some(BufferKind::Bit) ); assert_eq!( BufferKind::from_data_type(DataType::Time { precision: 3 }), Some(BufferKind::Text { max_str_len: 12 }) ); assert_eq!( BufferKind::from_data_type(DataType::Timestamp { precision: 3 }), Some(BufferKind::Timestamp) );
Trait Implementations
impl Clone for BufferKind[src]
fn clone(&self) -> BufferKind[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for BufferKind[src]
impl Debug for BufferKind[src]
impl Eq for BufferKind[src]
impl PartialEq<BufferKind> for BufferKind[src]
fn eq(&self, other: &BufferKind) -> bool[src]
fn ne(&self, other: &BufferKind) -> bool[src]
impl StructuralEq for BufferKind[src]
impl StructuralPartialEq for BufferKind[src]
Auto Trait Implementations
impl RefUnwindSafe for BufferKind
impl Send for BufferKind
impl Sync for BufferKind
impl Unpin for BufferKind
impl UnwindSafe for BufferKind
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,