[−][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<&[u8]>
[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.
Trait Implementations
impl CData for TextColumn
[src]
fn cdata_type(&self) -> CDataType
[src]
fn indicator_ptr(&self) -> *const isize
[src]
fn value_ptr(&self) -> *const c_void
[src]
fn buffer_length(&self) -> isize
[src]
impl CDataMut for TextColumn
[src]
fn mut_indicator_ptr(&mut self) -> *mut isize
[src]
fn mut_value_ptr(&mut self) -> *mut c_void
[src]
impl Input for TextColumn
[src]
Auto Trait Implementations
impl RefUnwindSafe for TextColumn
impl Send for TextColumn
impl Sync for TextColumn
impl Unpin for TextColumn
impl UnwindSafe for TextColumn
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>,