refactor(mdb): remove dummy bind_col from list_tables_sync#93
Merged
Conversation
The dummy column bind was a workaround for mdbtools 1.0.x requiring SQLBindCol before SQLFetch. With the safe conn.execute() refactoring in query and fetch_table_row_count, try the same approach here: remove the dummy bind and use cursor.next_row() directly after SQLTables. The single remaining unsafe (CursorImpl::new) is unavoidable — odbc-api does not provide a safe wrapper for catalog functions like SQLTables.
…ysObjects Replace the ODBC catalog function SQLTables (which requires unsafe CursorImpl::new) with a direct conn.execute() query to MSysObjects. This eliminates the last unsafe block in the MDB module — zero unsafe in the entire remote-table source now. MSysObjects.Type values: 1=local table, 4=linked ODBC, 5=query/view, 6=linked table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
移除
list_tables_sync中的 dummy bind_col 绕过方案(12 行删除),2 个 unsafe 减少为 1 个。Remaining unsafe
unsafe { CursorImpl::new(stmt) }无法避免 — odbc-api 没有为SQLTables等目录函数提供安全封装。Connection只有execute()和prepare(),没有tables()。Current state
项目 unsafe 分布(全部在 mdb/mod.rs):
infer_schema: 0 unsafe ✅query: 0 unsafe ✅fetch_table_row_count: 0 unsafe ✅list_tables_sync: 1 unsafe(CursorImpl::new,无法消除)