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

Microsoft.Data.Sqlite: Handle non-queries in SqliteDataReader #16053

Merged
merged 1 commit into from
Jun 13, 2019
Merged

Microsoft.Data.Sqlite: Handle non-queries in SqliteDataReader #16053

merged 1 commit into from
Jun 13, 2019

Conversation

bricelam
Copy link
Contributor

Fixes #16044


/// <summary>
/// Gets the value of the specified column.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value.</returns>
public override object this[int ordinal]
=> _record[ordinal];
=> _record == null
Copy link
Contributor

Choose a reason for hiding this comment

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

you could use throw exception. Upto you.

Copy link
Contributor Author

@bricelam bricelam Jun 13, 2019

Choose a reason for hiding this comment

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

You mean like this?

    => _record?[ordinal] ?? throw new InvalidOperationException(Resources.NoData);

It didn't feel ...mathematically correct since the field value could be NULL. It's not actually an issue since NULL in the database is handled very differently; it just felt like the semantics got a bit fuzzy.

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.

NRE in Sqlite's 3 preview 5
2 participants