[][src]Struct hdbconnect::types::BLob

pub struct BLob(_);

LOB implementation for binary values that is used within HdbValue::BLOB instances coming from the database.

Bigger LOBs are not transferred completely in the first roundtrip, instead more data are fetched in subsequent roundtrips when they are needed.

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

Implementations

impl BLob[src]

pub fn into_bytes(self) -> HdbResult<Vec<u8>>[src]

Converts the BLob into a Vec.

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

Example

 let mut resultset = connection.query(query)?;
 let mut blob = resultset.into_single_row()?.into_single_value()?.try_into_blob()?;

 let b = blob.into_bytes()?; // Vec<u8>, can be huge

Alternative

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

Example

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

Errors

Several variants of HdbError can occur.

pub fn read_slice(&mut self, offset: u64, length: u32) -> HdbResult<Vec<u8>>[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 BLob does not contain data.

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

Returns the maximum size the internal buffers ever had, 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 BLob object.

Trait Implementations

impl Clone for BLob[src]

impl Debug for BLob[src]

impl Read for BLob[src]

Auto Trait Implementations

impl RefUnwindSafe for BLob

impl Send for BLob

impl Sync for BLob

impl Unpin for BLob

impl UnwindSafe for BLob

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