From 62b1cab560564859f5514fadbc22f58bf3d15ee0 Mon Sep 17 00:00:00 2001 From: Linwei Zhang Date: Mon, 22 Jun 2026 14:07:14 +0800 Subject: [PATCH 1/2] refactor(mdb): remove dummy bind_col workaround from query path The dummy column bind was a workaround for mdbtools 1.0.x which required SQLBindCol before SQLFetch. With odbc-api's safe conn.execute() wrapper handling the statement lifecycle, try removing this workaround to see if mdbtools no longer hangs on SQLFetch without prior SQLBindCol. --- remote-table/src/connection/mdb/mod.rs | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/remote-table/src/connection/mdb/mod.rs b/remote-table/src/connection/mdb/mod.rs index 52f7ee7..6a74566 100644 --- a/remote-table/src/connection/mdb/mod.rs +++ b/remote-table/src/connection/mdb/mod.rs @@ -19,7 +19,7 @@ use datafusion_physical_plan::stream::RecordBatchStreamAdapter; use futures::lock::Mutex; use log::debug; use odbc_api::Environment; -use odbc_api::handles::{AsStatementRef, SqlResult, SqlText, Statement, StatementImpl}; +use odbc_api::handles::{SqlResult, SqlText, Statement, StatementImpl}; use odbc_api::{Cursor, CursorImpl}; use std::collections::HashMap; use std::path::PathBuf; @@ -249,28 +249,6 @@ impl Connection for MdbConnection { )) })?; - // mdbtools 1.0.x requires SQLBindCol before SQLFetch — without it, - // SQLFetch hangs indefinitely. odbc-api's Cursor::next_row() calls - // SQLFetch without binding columns. - // - // Workaround: bind a single dummy column (column 1) to allow - // SQLFetch to proceed, then use the row-by-row Cursor::next_row() - // path which calls SQLGetData for each cell. SQLGetData after - // SQLBindCol works because the dummy buffer is ignored. - let mut dummy = odbc_api::Nullable::::null(); - match unsafe { cursor.as_stmt_ref().bind_col(1, &mut dummy) } { - SqlResult::Success(()) | SqlResult::SuccessWithInfo(()) => {} - SqlResult::Error { function } => { - return Err(DataFusionError::Execution(format!( - "{function} failed binding dummy column for mdb" - ))); - } - other => { - return Err(DataFusionError::Execution(format!( - "Unexpected result binding dummy column: {other:?}" - ))); - } - } let mut exhausted = false; loop { From bd819b5880d7af0579fda1a05a030871123042c0 Mon Sep 17 00:00:00 2001 From: Linwei Zhang Date: Mon, 22 Jun 2026 14:09:55 +0800 Subject: [PATCH 2/2] chore: trigger CI