pub unsafe trait Blob: HasDataType {
// Required methods
fn c_data_type(&self) -> CDataType;
fn size_hint(&self) -> Option<usize>;
fn next_batch(&mut self) -> Result<Option<&[u8]>>;
// Provided method
fn as_blob_param(&mut self) -> BlobParam<'_>
where Self: Sized { ... }
}Expand description
A Blob can stream its contents to the database batch by batch and may therefore be used to
transfer large amounts of data, exceeding the drivers capabilities for normal input parameters.
Safety
If a hint is implemented for blob_size it must be accurate before the first call to
next_batch.
Required Methods§
sourcefn c_data_type(&self) -> CDataType
fn c_data_type(&self) -> CDataType
CData type of the binary data returned in the batches. Likely to be either
crate::sys::CDataType::Binary, crate::sys::CDataType::Char or
crate::sys::CDataType::WChar.
sourcefn size_hint(&self) -> Option<usize>
fn size_hint(&self) -> Option<usize>
Hint passed on to the driver regarding the combined size of all the batches. This hint is
passed then the parameter is bound to the statement, so its meaning is only defined before
the first call to next_batch. If None no hint about the total length of the batches is
passed to the driver and the indicator will be set to crate::sys::DATA_AT_EXEC.
sourcefn next_batch(&mut self) -> Result<Option<&[u8]>>
fn next_batch(&mut self) -> Result<Option<&[u8]>>
Retrieve the next batch of data from the source. Batches may not be empty. None indicates
the last batch has been reached.
Provided Methods§
sourcefn as_blob_param(&mut self) -> BlobParam<'_>where
Self: Sized,
fn as_blob_param(&mut self) -> BlobParam<'_>where
Self: Sized,
Convinience function. Same as calling self::BlobParam::new.