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

source

pub fn from_descs( capacity: usize, descs: impl IntoIterator<Item = BufferDesc> ) -> Self

Allocates a ColumnarBuffer fitting the buffer descriptions.

source

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.

source

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>

source

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.

source

pub unsafe fn new_unchecked(capacity: usize, columns: Vec<(u16, C)>) -> Self

Safety
  • Indices must be unique
  • Columns all must have enough capacity.
source

pub fn num_rows(&self) -> usize

Number of valid rows in the buffer.

source

pub fn num_cols(&self) -> usize

Return the number of columns in the row set.

source

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 is buffer_index = column_index - 1.

Trait Implementations§

source§

impl<C> RowSetBuffer for ColumnarBuffer<C>where C: ColumnBuffer,

source§

fn bind_type(&self) -> usize

Declares the bind type of the Row set buffer. 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.
source§

fn row_array_size(&self) -> usize

The batch size for bulk cursors, if retrieving many rows at once.
source§

fn mut_num_fetch_rows(&mut self) -> &mut usize

Mutable reference to the number of fetched rows. Read more
source§

unsafe fn bind_colmuns_to_cursor( &mut self, cursor: StatementRef<'_> ) -> Result<(), Error>

Binds the buffer either column or row wise to the cursor. Read more
source§

fn find_truncation(&self) -> Option<Indicator>

Find an indicator larger than the maximum element size of the buffer.