Skip to content
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

add missing QueryUnbufferedAsync<T> API #1912

Merged
merged 12 commits into from
Jun 9, 2023
Merged

add missing QueryUnbufferedAsync<T> API #1912

merged 12 commits into from
Jun 9, 2023

Conversation

mgravell
Copy link
Member

@mgravell mgravell commented Jun 9, 2023

I am not proposing to add the myriad of multi-read <T0, T1, ..., T5> APIs that go with this

@mgravell
Copy link
Member Author

mgravell commented Jun 9, 2023

I think this provides the core features wanted in #1692 and #1239, while being simpler

Copy link
Member

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

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

👍 Thanks for tweaks!

@mgravell mgravell merged commit d56340b into main Jun 9, 2023
1 of 2 checks passed
@mgravell mgravell deleted the queryunbufferedasync branch June 9, 2023 15:22
@plaisted
Copy link

I see a new release for this but nothing published to nuget, is this planned to be pushed?

@mgravell
Copy link
Member Author

mgravell commented Jun 12, 2023 via email


var func = tuple.Func;

var convertToType = Nullable.GetUnderlyingType(effectiveType) ?? effectiveType;
Copy link
Contributor

Choose a reason for hiding this comment

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

This convertToType variable is not used. I guess it was meant to be used 4 lines below?

yield return GetValue<T>(reader, convertToType, val);

Copy link
Member Author

@mgravell mgravell Jun 13, 2023

Choose a reason for hiding this comment

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

You're almost certainly correct; thanks, good eyes! I'll try to look at this tomorrow (I guess I need some tests that do QueryUnbufferedAsync<int>, QueryUnbufferedAsync<int?>, QueryUnbufferedAsync<string>, QueryUnbufferedAsync<SomeValueType> and QueryUnbufferedAsync<SomeClass>

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe it should just be deleted because apparently the convertToType is already computed inside GetValue<T>(…).

Copy link
Member Author

@mgravell mgravell Jun 13, 2023

Choose a reason for hiding this comment

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

added for tracking: #1920 (because already merged)

Copy link
Contributor

Choose a reason for hiding this comment

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

good eyes

Actually, it's JetBrains Rider dimming unused variables. 😉

image

/// A sequence of data of <typeparamref name="T"/>; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is
/// created per row, and a direct column-name===member-name mapping is assumed (case insensitive).
/// </returns>
public static IAsyncEnumerable<T> QueryUnbufferedAsync<T>(this DbConnection cnn, string sql, object param = null, DbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)

Choose a reason for hiding this comment

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

Is there a reason this is using a DbConnection and not an IDbConnection?

Copy link
Member

Choose a reason for hiding this comment

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

Async doesn't work on IDbConnection, it never has. We should have done this with the old methods but can't break things now - IDbConnection simply predates async being a thing, so it never had support. The methods needed are on the abstract base class.

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.

None yet

5 participants