-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronously connecting to a database #253
Comments
ahh this is nice that your adding this. However can you add a few examples of how to use it? Currently I am doing something like the below in my async code.
get_string is a custom trait implement which just does
any idea on how this could be converter to use the async code or will i need to wait for a few more implementations before I can? |
Most of that you can do already. For asynchronously executing something there is already a code example here: https://docs.rs/odbc-api/latest/odbc_api/struct.Connection.html#method.execute_polling Of course you don't execute an insert statement, but a query with a result set. You'll find that The Does this answer your question? Cheers, Markus |
ahh I was having issue trying to figure out how to pass the cursor to TextRowSet::for_cursor(5000, &mut cursor, Some(4096)) so that way i could use the cursor the way I am currently using it. |
Nope, you are right. Oversight on my part. You currently have no (good) way to get metadata on the result set using an asynchronous cursor. I'll open an issue for this. |
Thank you. Yeah I was attempting to switch my Axum lib and depreciate my Block method in place of this and noticed there was no way that I could see to use it. |
Yeah, my mistake. Maybe announced it a tad to early 😅 |
So, now there is no way to fetch data from DB asynchronously? =( |
Fetching data asynchronously works with ODBC if:
You may want to look into https://docs.rs/odbc-api/latest/odbc_api/struct.Connection.html#method.execute_polling for a code example of how to execute a statement asynchronously. If it would turn out, that Maybe I'll be able to help better, if you tell me a bit more about your usecase Best, Markus |
Queries can already be executed asynchronously, but opening the connection is still blocking.
The text was updated successfully, but these errors were encountered: