[][src]Struct hdbconnect::types::CLob

pub struct CLob(_);

LOB implementation for unicode Strings that is used with HdbValue::CLOB (which is deprecated).

Note that the CLOB type is not recommended for use. CLOB fields are supposed to only store ASCII7, but HANA doesn't check this.

CLob respects the Connection's lob read length (see Connection::set_lob_read_length), by transferring per fetch request lob_read_length bytes.

Implementations

impl CLob[src]

pub fn into_string(self) -> HdbResult<String>[src]

Converts the CLob into the contained String.

All outstanding data (data that were not yet fetched from the server) are fetched into this CLob object, before the complete data, as far as they were not yet read from this CLob object, are returned.

Example

 let mut resultset = connection.query(query)?;
 let mut clob = resultset.into_single_row()?.into_single_value()?.try_into_clob()?;
 let s = clob.into_string(); // String, can be huge

Alternative

For larger objects, a streaming approach using the Read implementation of CLob might by more appropriate, to avoid total allocation of the large object.

Example

 let mut writer;
 // ... writer gets instantiated, is an implementation of std::io::Write;

 std::io::copy(&mut clob, &mut writer)?;

Errors

Several variants of HdbError can occur.

pub fn read_slice(
    &mut self,
    offset: u64,
    length: u32
) -> HdbResult<CharLobSlice>
[src]

Reads from given offset and the given length, in bytes.

Errors

Several variants of HdbError can occur.

pub fn total_byte_length(&self) -> u64[src]

Total length of data, in bytes.

pub fn is_empty(&self) -> bool[src]

Returns true if the CLob does not contain data.

pub fn max_buf_len(&self) -> usize[src]

Returns the maximum size of the internal buffer, in bytes.

This method exists mainly for debugging purposes. With streaming, the returned value is not supposed to exceed lob_read_length (see Connection::set_lob_read_length) plus the buffer size used by the reader.

pub fn cur_buf_len(&self) -> usize[src]

Current size of the internal buffer, in bytes.

pub fn server_usage(&self) -> ServerUsage[src]

Provides information about the the server-side resource consumption that is related to this CBLob object.

Trait Implementations

impl Clone for CLob[src]

impl Debug for CLob[src]

impl Read for CLob[src]

Auto Trait Implementations

impl RefUnwindSafe for CLob

impl Send for CLob

impl Sync for CLob

impl Unpin for CLob

impl UnwindSafe for CLob

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> ReadBytesExt for R where
    R: Read + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,