Skip to content

Conversation

@matthewgapp
Copy link

@matthewgapp matthewgapp commented Jul 13, 2024

Adds support for async metadata, which is required for async support in arrow-odbc.

See #578 for more context.

/// See also:
/// <https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/result-set-metadata>
pub trait AsyncResultSetMetadata: AsStatementRef {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This trait is basically 1:1 ResultSetMetadata trait with implementation tweaks to account for methods that are async

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far I dodged thinking about async traits and their implications. Especially whether I can safely claim the resulting futures to be Send. I doged this issue so far by having BlockCursorPolling not implementing any Cursor trait, but just offering everything directly in the implementation. Yet I can also see Rust made some advances in async support since I last touched the issue.

Since there are many ways to implement asynchronous behavior in ODBC I would probably prefer the prefix Polling instead of Async.

Since this would require many tests I would also fine contributing and reviewing this trait in multiple steps, splitting among supported functions.

@matthewgapp matthewgapp changed the title Async metadata Async metadata support Jul 13, 2024
let lazy_statement = move || self.allocate_statement();
let lazy_statement = move || {
self.allocate_statement().and_then(|mut stmt| {
stmt.set_async_enable(true).into_result(&stmt)?;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flyby: shouldn't this implementation set the statement to be async?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch: Fixed in 8.1.2

@matthewgapp matthewgapp changed the title Async metadata support async metadata support Jul 13, 2024
let mut ret = (f)();
// Wait for operation to finish, using polling method
while matches!(ret, SqlResult::StillExecuting) {
info!("Waiting for operation to finish.");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using this to debug #578

@pacman82 pacman82 mentioned this pull request Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants