pub struct TextColumnView<'c, C> { /* private fields */ }
Expand description
Allows read only access to the valid part of a text column.
You may ask, why is this type required, should we not just be able to use &TextColumn
? The
problem with TextColumn
is, that it is a buffer, but it has no idea how many of its members
are actually valid, and have been returned with the last row group of the the result set. That
number is maintained on the level of the entire column buffer. So a text column knows the number
of valid rows, in addition to holding a reference to the buffer, in order to guarantee, that
every element acccessed through it, is valid.
Implementations§
Source§impl<'c, C> TextColumnView<'c, C>
impl<'c, C> TextColumnView<'c, C>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True if, and only if there are no valid rows in the column buffer.
Sourcepub fn get(&self, index: usize) -> Option<&'c [C]>
pub fn get(&self, index: usize) -> Option<&'c [C]>
Slice of text at the specified row index without terminating zero.
Sourcepub fn iter(&self) -> TextColumnIt<'c, C>
pub fn iter(&self) -> TextColumnIt<'c, C>
Iterator over the valid elements of the text buffer
Sourcepub fn content_length_at(&self, row_index: usize) -> Option<usize>
pub fn content_length_at(&self, row_index: usize) -> Option<usize>
Length of value at the specified position. This is different from an indicator as it refers to the length of the value in the buffer, not to the length of the value in the datasource. The two things are different for truncated values.
Sourcepub fn raw_value_buffer(&self) -> &'c [C]
pub fn raw_value_buffer(&self) -> &'c [C]
Provides access to the raw underlying value buffer. Normal applications should have little reason to call this method. Yet it may be useful for writing bindings which copy directly from the ODBC in memory representation into other kinds of buffers.
The buffer contains the bytes for every non null valid element, padded to the maximum string
length. The content of the padding bytes is undefined. Usually ODBC drivers write a
terminating zero at the end of each string. For the actual value length call
Self::content_length_at
. Any element starts at index * (Self::max_len
+ 1).
pub fn max_len(&self) -> usize
Sourcepub fn has_truncated_values(&self) -> Option<Indicator>
pub fn has_truncated_values(&self) -> Option<Indicator>
Some
if any value is truncated.
After fetching data we may want to know if any value has been truncated due to the buffer not being able to hold elements of that size. This method checks the indicator buffer element wise.
Trait Implementations§
Source§impl<'c, C: Clone> Clone for TextColumnView<'c, C>
impl<'c, C: Clone> Clone for TextColumnView<'c, C>
Source§fn clone(&self) -> TextColumnView<'c, C>
fn clone(&self) -> TextColumnView<'c, C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more