Skip to content

Commit a26abd7

Browse files
committed
refactor: use next_blob_param helper also in execute
1 parent 11aa95a commit a26abd7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

odbc-api/src/execute.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ where
109109
if need_data {
110110
// Check if any delayed parameters have been bound which stream data to the database at
111111
// statement execution time. Loops over each bound stream.
112-
while let Some(blob_ptr) = stmt.param_data().into_result(&stmt)? {
113-
// The safe interfaces currently exclusively bind pointers to `Blob` trait objects
114-
let blob_ptr: *mut &mut dyn Blob = transmute(blob_ptr);
115-
let blob_ref = &mut *blob_ptr;
112+
while let Some(blob_ref) = next_blob_param(&mut stmt)? {
116113
// Loop over all batches within each blob
117114
while let Some(batch) = blob_ref.next_batch().map_err(Error::FailedReadingInput)? {
118115
stmt.put_binary_batch(batch).into_result(&stmt)?;
@@ -194,7 +191,7 @@ unsafe fn next_blob_param<'a>(
194191
let maybe_ptr = stmt.param_data().into_result(stmt)?;
195192
if let Some(blob_ptr) = maybe_ptr {
196193
// The safe interfaces currently exclusively bind pointers to `Blob` trait objects
197-
let blob_ptr: *mut &mut dyn Blob = unsafe { std::mem::transmute(blob_ptr) };
194+
let blob_ptr: *mut &mut dyn Blob = unsafe { transmute(blob_ptr) };
198195
let blob_ref = unsafe { &mut *blob_ptr };
199196
Ok(Some(*blob_ref))
200197
} else {

0 commit comments

Comments
 (0)