pub struct BinColumn { /* private fields */ }Expand description
A buffer intended to be bound to a column of a cursor. Elements of the buffer will contain a variable amount of bytes up to a maximum length. Since elements of this type have variable length an additional indicator buffer is also maintained, whether the column is nullable or not. Therefore this buffer type is used for variable sized binary data whether it is nullable or not.
Implementations
This will allocate a value and indicator buffer for batch_size elements. Each value may
have a maximum length of max_len.
Return the value for the given row index.
Safety
The column buffer does not know how many elements were in the last row group, and therefore
can not guarantee the accessed element to be valid and in a defined state. It also can not
panic on accessing an undefined element. It will panic however if row_index is larger or
equal to the maximum number of elements in the buffer.
Changes the maximum element length the buffer can hold. This operation is useful if you find an unexpected large input during insertion. All values in the buffer will be set to NULL.
Parameters
new_max_len: New maximum string length without terminating zero.
pub unsafe fn iter(&self, num_rows: usize) -> BinColumnIt<'_>ⓘNotable traits for BinColumnIt<'c>impl<'c> Iterator for BinColumnIt<'c> type Item = Option<&'c [u8]>;
pub unsafe fn iter(&self, num_rows: usize) -> BinColumnIt<'_>ⓘNotable traits for BinColumnIt<'c>impl<'c> Iterator for BinColumnIt<'c> type Item = Option<&'c [u8]>;
impl<'c> Iterator for BinColumnIt<'c> type Item = Option<&'c [u8]>;Iterator over the first num_rows values of a binary column.
Safety
Num rows may not exceed the actually amount of valid num_rows filled be the ODBC API. The
column buffer does not know how many elements were in the last row group, and therefore can
not guarantee the accessed element to be valid and in a defined state. It also can not panic
on accessing an undefined element. It will panic however if row_index is larger or equal
to the maximum number of elements in the buffer.
Sets the value of the buffer at index to NULL or the specified bytes. This method will panic on out of bounds index, or if input holds a value which is longer than the maximum allowed element length.
Fills the column with NULL, between From and To
A writer able to fill the first n elements of the buffer, from an iterator.
Changes the maximum number of bytes per row the buffer can hold. This operation is useful if you find an unexpected large input during insertion.
This is however costly, as not only does the new buffer have to be allocated, but all values have to copied from the old to the new buffer.
This method could also be used to reduce the maximum length, which would truncate values in the process.
This method does not adjust indicator buffers as these might hold values larger than the maximum length.
Parameters
new_max_len: New maximum element length in bytes.num_rows: Number of valid rows currently stored in this buffer.
Appends a new element to the column buffer. Rebinds the buffer to increase maximum element length should the input be to large.
Parameters
index: Zero based index of the new row position. Must be equal to the number of rows currently in the buffer.bytes: Value to store.
Trait Implementations
The identifier of the C data type of the value buffer. When it is retrieving data from the
data source with fetch, the driver converts the data to this type. When it sends data to
the source, the driver converts the data from this type. Read more
Indicates the length of variable sized types. May be zero for fixed sized types. Used to determine the size or existence of input parameters. Read more
Pointer to a value corresponding to the one described by cdata_type.
Maximum length of the type in bytes (not characters). It is required to index values in
bound buffers, if more than one parameter is bound. Can be set to zero for types not bound
as parameter arrays, i.e. CStr. Read more
Indicates the length of variable sized types. May be zero for fixed sized types.
Pointer to a value corresponding to the one described by cdata_type.