[−][src]Struct odbc_api::buffers::TextColumn
A buffer intended to be bound to a column of a cursor. Elements of the buffer will contain a variable amount of characters up to a maximum string length. Since most SQL types have a string representation this buffer can be bound to a column of almost any type, ODBC driver and driver manager should take care of the conversion. Since elements of this type have variable length an indicator buffer needs to be bound, whether the column is nullable or not, and therefore does not matter for this buffer.
Implementations
impl TextColumn
[src]
pub fn new(batch_size: usize, max_str_len: usize) -> Self
[src]
This will allocate a value and indicator buffer for batch_size
elements. Each value may
have a maximum length of max_str_len
. This implies that max_str_len
is increased by
one in order to make space for the null terminating zero at the end of strings.
pub unsafe fn value_at(&self, row_index: usize) -> Option<&CStr>
[src]
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.
pub fn rebind(&mut self, new_max_str_len: usize, num_rows: usize)
[src]
Changes the max_str_len of the buffer. This operation is useful if you find an unexpected large input string 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 string length, which would truncate strings in the process.
Parameters
new_max_str_len
: New maximum string length without terminating zero.num_rows
: Number of valid rows currently stored in this buffer.
pub fn append(&mut self, index: usize, text: Option<&[u8]>)
[src]
Appends a new element to the column buffer. Rebinds the buffer to increase maximum string length should text 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.text
: Text to store without terminating zero.
pub unsafe fn iter(&self, num_rows: usize) -> TextColumnIt<'_>ⓘNotable traits for TextColumnIt<'c>
impl<'c> Iterator for TextColumnIt<'c> type Item = Option<&'c CStr>;
[src]
Notable traits for TextColumnIt<'c>
impl<'c> Iterator for TextColumnIt<'c> type Item = Option<&'c CStr>;
Iterator over the first num_rows
values of a text column.
Safety
Num rows may not exceed the actualy 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.
Trait Implementations
impl CData for TextColumn
[src]
pub fn cdata_type(&self) -> CDataType
[src]
pub fn indicator_ptr(&self) -> *const isize
[src]
pub fn value_ptr(&self) -> *const c_void
[src]
pub fn buffer_length(&self) -> isize
[src]
impl CDataMut for TextColumn
[src]
pub fn mut_indicator_ptr(&mut self) -> *mut isize
[src]
pub fn mut_value_ptr(&mut self) -> *mut c_void
[src]
impl Debug for TextColumn
[src]
impl HasDataType for TextColumn
[src]
Auto Trait Implementations
impl RefUnwindSafe for TextColumn
[src]
impl Send for TextColumn
[src]
impl Sync for TextColumn
[src]
impl Unpin for TextColumn
[src]
impl UnwindSafe for TextColumn
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,