pub unsafe trait Blob: HasDataType {
fn c_data_type(&self) -> CDataType;
fn size_hint(&self) -> Option<usize>;
fn next_batch(&mut self) -> Result<Option<&[u8]>>;
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
fn 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
.
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
.
Provided methods
fn 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
.