Skip to content

Allow reading bool as integer, like MySql.Data allows (Fixes #782) #783

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

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

danielgindi
Copy link
Contributor

No description provided.

columnDefinition.ColumnType != ColumnType.Short &&
columnDefinition.ColumnType != ColumnType.Int24 &&
columnDefinition.ColumnType != ColumnType.Long &&
columnDefinition.ColumnType != ColumnType.Longlong &&
columnDefinition.ColumnType != ColumnType.Bit &&
columnDefinition.ColumnType != ColumnType.Year &&
columnDefinition.ColumnType != ColumnType.Decimal &&
columnDefinition.ColumnType != ColumnType.NewDecimal) ||
(columnDefinition.ColumnType == ColumnType.Tiny && Connection.TreatTinyAsBoolean && columnDefinition.ColumnLength == 1 && (columnDefinition.ColumnFlags & ColumnFlags.Unsigned) == 0))
columnDefinition.ColumnType != ColumnType.NewDecimal)
Copy link
Member

Choose a reason for hiding this comment

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

I suspect this fails to coerce "bool" values to 0 or 1.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed: 693b8e0

@bgrainger bgrainger merged commit bec152d into mysql-net:master Mar 26, 2020
@danielgindi
Copy link
Contributor Author

Great!

Btw how do you explain why GetInt32 is so different the implementation of other int getters?
It seems like it’s duplicating the code of GetValue, adding a lot of checks and manually parsing the raw data.

@bgrainger
Copy link
Member

See #721 for the rationale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants