pub struct BulkInsert { /* private fields */ }Expand description
Active bulk insert operation.
This struct manages the streaming of row data to the server.
Call send_row() for each row, then finish() to complete.
Implementations§
Source§impl BulkInsert
impl BulkInsert
Sourcepub fn new(columns: Vec<BulkColumn>, batch_size: usize) -> Self
pub fn new(columns: Vec<BulkColumn>, batch_size: usize) -> Self
Create a new bulk insert operation.
Source§impl BulkInsert
impl BulkInsert
Sourcepub fn take_packets(&mut self) -> Vec<BytesMut>
pub fn take_packets(&mut self) -> Vec<BytesMut>
Get the buffered data as packets ready to send.
Returns a vector of complete TDS packets with BulkLoad packet type (0x07).
Sourcepub fn total_rows(&self) -> u64
pub fn total_rows(&self) -> u64
Get total rows sent so far.
Sourcepub fn rows_in_batch(&self) -> usize
pub fn rows_in_batch(&self) -> usize
Get rows in current batch.
Sourcepub fn should_flush(&self) -> bool
pub fn should_flush(&self) -> bool
Check if a batch flush is needed.
Sourcepub fn finish_packets(&mut self) -> Vec<BytesMut>
pub fn finish_packets(&mut self) -> Vec<BytesMut>
Prepare for finishing the bulk operation. Writes the DONE token and returns final packets.
Sourcepub fn result(&self) -> BulkInsertResult
pub fn result(&self) -> BulkInsertResult
Create a result from the current state.
Auto Trait Implementations§
impl Freeze for BulkInsert
impl RefUnwindSafe for BulkInsert
impl Send for BulkInsert
impl Sync for BulkInsert
impl Unpin for BulkInsert
impl UnwindSafe for BulkInsert
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more