Type Alias odbc_api::buffers::ColumnarAnyBuffer
source · pub type ColumnarAnyBuffer = ColumnarBuffer<AnyBuffer>;
Expand description
Flexible columnar buffer implementation. Bind this to a cursor to fetch values in bulk, or pass this as a parameter to a statement, to submit many parameters at once.
Aliased Type§
struct ColumnarAnyBuffer { /* private fields */ }
Implementations§
source§impl ColumnarAnyBuffer
impl ColumnarAnyBuffer
sourcepub fn from_descs(
capacity: usize,
descs: impl IntoIterator<Item = BufferDesc>
) -> Self
pub fn from_descs( capacity: usize, descs: impl IntoIterator<Item = BufferDesc> ) -> Self
Allocates a ColumnarBuffer
fitting the buffer descriptions.
sourcepub fn try_from_descs(
capacity: usize,
descs: impl IntoIterator<Item = BufferDesc>
) -> Result<Self, Error>
pub fn try_from_descs( capacity: usize, descs: impl IntoIterator<Item = BufferDesc> ) -> Result<Self, Error>
Allocates a ColumnarBuffer
fitting the buffer descriptions. If not enough memory is
available to allocate the buffers this function fails with
Error::TooLargeColumnBufferSize
. This function is slower than Self::from_descs
which would just panic if not enough memory is available for allocation.
sourcepub fn from_descs_and_indices(
max_rows: usize,
description: impl Iterator<Item = (u16, BufferDesc)>
) -> ColumnarBuffer<AnyBuffer>
pub fn from_descs_and_indices( max_rows: usize, description: impl Iterator<Item = (u16, BufferDesc)> ) -> ColumnarBuffer<AnyBuffer>
Allows you to pass the buffer descriptions together with a one based column index referring the column, the buffer is supposed to bind to. This allows you also to ignore columns in a result set, by not binding them at all. There is no restriction on the order of column indices passed, but the function will panic, if the indices are not unique.
source§impl<C: ColumnBuffer> ColumnarBuffer<C>
impl<C: ColumnBuffer> ColumnarBuffer<C>
sourcepub fn new(columns: Vec<(u16, C)>) -> Self
pub fn new(columns: Vec<(u16, C)>) -> Self
Create a new instance from columns with unique indicies. Capacity of the buffer will be the minimum capacity of the columns. The constructed buffer is always empty (i.e. the number of valid rows is considered to be zero).
You do not want to call this constructor directly unless you want to provide your own buffer
implentation. Most users of this crate may want to use the constructors like
[crate::buffers::ColumnarAnyBuffer::from_description
] or
crate::buffers::TextRowSet::from_max_str_lens
instead.
sourcepub unsafe fn new_unchecked(capacity: usize, columns: Vec<(u16, C)>) -> Self
pub unsafe fn new_unchecked(capacity: usize, columns: Vec<(u16, C)>) -> Self
Safety
- Indices must be unique
- Columns all must have enough
capacity
.
sourcepub fn column(&self, buffer_index: usize) -> C::View<'_>
pub fn column(&self, buffer_index: usize) -> C::View<'_>
Use this method to gain read access to the actual column data.
Parameters
buffer_index
: Please note that the buffer index is not identical to the ODBC column index. For one it is zero based. It also indexes the buffer bound, and not the columns of the output result set. This is important, because not every column needs to be bound. Some columns may simply be ignored. That being said, if every column of the output is bound in the buffer, in the same order in which they are enumerated in the result set, the relationship between column index and buffer index isbuffer_index = column_index - 1
.
Trait Implementations§
source§impl<C> RowSetBuffer for ColumnarBuffer<C>where
C: ColumnBuffer,
impl<C> RowSetBuffer for ColumnarBuffer<C>where C: ColumnBuffer,
source§fn bind_type(&self) -> usize
fn bind_type(&self) -> usize
0
Means a columnar binding is used. Any non
zero number is interpreted as the size of a single row in a row wise binding style.