odbc_api::buffers

Struct TextColumnView

Source
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>

Source

pub fn len(&self) -> usize

The number of valid elements in the text column.

Source

pub fn is_empty(&self) -> bool

True if, and only if there are no valid rows in the column buffer.

Source

pub fn get(&self, index: usize) -> Option<&'c [C]>

Slice of text at the specified row index without terminating zero.

Source

pub fn iter(&self) -> TextColumnIt<'c, C>

Iterator over the valid elements of the text buffer

Source

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.

Source

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).

Source

pub fn max_len(&self) -> usize

Source

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>

Source§

fn clone(&self) -> TextColumnView<'c, C>

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<'c, C: Debug> Debug for TextColumnView<'c, C>

Source§

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

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

impl<'c, C: Copy> Copy for TextColumnView<'c, C>

Auto Trait Implementations§

§

impl<'c, C> Freeze for TextColumnView<'c, C>

§

impl<'c, C> RefUnwindSafe for TextColumnView<'c, C>
where C: RefUnwindSafe,

§

impl<'c, C> Send for TextColumnView<'c, C>
where C: Sync,

§

impl<'c, C> Sync for TextColumnView<'c, C>
where C: Sync,

§

impl<'c, C> Unpin for TextColumnView<'c, C>

§

impl<'c, C> UnwindSafe for TextColumnView<'c, C>
where C: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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>,

Source§

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>,

Source§

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