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: Improve SqliteDataReader.GetFieldType() when NULL #13831

Closed
bricelam opened this issue Oct 2, 2017 · 2 comments · Fixed by #14315
Closed

Microsoft.Data.Sqlite: Improve SqliteDataReader.GetFieldType() when NULL #13831

bricelam opened this issue Oct 2, 2017 · 2 comments · Fixed by #14315
Assignees
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@bricelam
Copy link
Contributor

bricelam commented Oct 2, 2017

SqliteDataReader.GetFieldType(0) returns int when the value is NULL. We should improve this.

Thoughts:

  • This should probably return DBNull, but will that break other assumptions in ADO.NET?
  • If we simply don't have enough information to determine the type, should we...
    • ...throw?
    • ...use a highly-compatible type (like string)?
    • ...use the type affinity of its column?
@toolgood
Copy link

I met this problem, too.

@bricelam bricelam self-assigned this Jun 6, 2018
@Perksey
Copy link
Member

Perksey commented Oct 13, 2018

Well, there will always be a case in which using a highly compatible type will fail, but I think using one is a lot better than assuming the type in an int. As such, I'm +1 on the idea of using string.

P.S. I had a look at whether you can use DbNull in this situation, but wasn't able to find a definitive answer.

EDIT: It seems like DataColumn does this by using string, so I think it'd be safe to use string here

@ajcvickers ajcvickers transferred this issue from aspnet/Microsoft.Data.Sqlite Oct 31, 2018
@ajcvickers ajcvickers added this to the 3.0.0 milestone Oct 31, 2018
@ajcvickers ajcvickers changed the title Improve SqliteDataReader.GetFieldType() when NULL Microsoft.Data.Sqlite: Improve SqliteDataReader.GetFieldType() when NULL Oct 31, 2018
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 25, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants