Enum odbc_api::buffers::BufferDesc

source ·
pub enum BufferDesc {
Show 14 variants Binary { length: usize, }, Text { max_str_len: usize, }, WText { max_str_len: usize, }, F64 { nullable: bool, }, F32 { nullable: bool, }, Date { nullable: bool, }, Time { nullable: bool, }, Timestamp { nullable: bool, }, I8 { nullable: bool, }, I16 { nullable: bool, }, I32 { nullable: bool, }, I64 { nullable: bool, }, U8 { nullable: bool, }, Bit { nullable: bool, },
}
Expand description

Describes a column of a crate::buffers::ColumnarBuffer.

While related to to the crate::DataType of the column this is bound to, the Buffer type is different as it does not describe the type of the data source but the format the data is going to be represented in memory. While the data source is often considered to choose the buffer type the kind of processing which is supposed to be applied to the data may be even more important if choosing the a buffer for the cursor type. E.g. if you intend to print a date to standard out it may be more reasonable to bind it as Text rather than Date.

Variants§

§

Binary

Variable sized binary buffer, holding up to length bytes per value.

Fields

§length: usize

Maximum number of bytes per value.

§

Text

Text buffer holding strings with binary length of up to max_str_len.

Consider an upper bound choosing this based on the information in a DataType::Varchar column. E.g. PostgreSQL may return a field size of several GiB for individual values if a column is specified as TEXT, or Microsoft SQL Server may return 0 for a column of type VARCHAR(max). In such situations, if values are truly that large, bulk fetching data is not recommended, but streaming individual fields one by one. Usually though, the actual cells of the table in the database contain much shorter values. The best thing todo is to adapt the database schema to better reflect the actual size of the values. Lacking control over the database schema, you can always choose a smaller buffer size than initializing the buffer in disagreement with the database schema.

Fields

§max_str_len: usize

Maximum string length. Terminating zero is excluded, i.e. memory for it will be implicitly allocated if required.

§

WText

UTF-16 encoded text buffer holding strings with length of up to max_str_len. Length is in terms of 2-Byte characters.

Fields

§max_str_len: usize

Maximum string length. Terminating zero is excluded, i.e. memory for it will be implicitly allocated if required.

§

F64

64 bit floating point

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

F32

32 bit floating point

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

Date

Describes a buffer holding crate::sys::Date values.

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

Time

Describes a buffer holding crate::sys::Time values.

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

Timestamp

Describes a buffer holding crate::sys::Timestamp values.

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

I8

Signed 8 Bit integer

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

I16

Signed 16 Bit integer

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

I32

Signed 32 Bit integer

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

I64

Signed 64 Bit integer

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

U8

Unsigned 8 Bit integer

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

§

Bit

Can either be zero or one

Fields

§nullable: bool

This indicates whether or not the buffer will be able to represent NULL values. This will cause an indicator buffer to be bound.

Implementations§

source§

impl BufferDesc

source

pub fn from_data_type(data_type: DataType, nullable: bool) -> Option<Self>

source

pub fn bytes_per_row(&self) -> usize

Element size of buffer if bound as a columnar row. Can be used to estimate memory for columnar bindings.

Trait Implementations§

source§

impl Clone for BufferDesc

source§

fn clone(&self) -> BufferDesc

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BufferDesc

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for BufferDesc

source§

fn eq(&self, other: &BufferDesc) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for BufferDesc

source§

impl Eq for BufferDesc

source§

impl StructuralPartialEq for BufferDesc

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more