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

Fix Dapper MySQLTests #261

Closed
bgrainger opened this issue May 12, 2017 · 2 comments
Closed

Fix Dapper MySQLTests #261

bgrainger opened this issue May 12, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@bgrainger
Copy link
Member

bgrainger commented May 12, 2017

Dapper includes a MySQLTests test suite.

If I change the tests to use the MySqlConnector NuGet package instead of MySql.Data, DapperEnumValue_Mysql fails with:

System.NotImplementedException : GetFieldType for Null is not implemented
   at MySql.Data.MySqlClient.Results.ResultSet.GetFieldType(Int32 ordinal)
   at MySql.Data.MySqlClient.MySqlDataReader.GetFieldType(Int32 ordinal)
   at Dapper.SqlMapper.GetColumnHash(IDataReader reader, Int32 startBound, Int32 length)
   at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType)
   at Dapper.SqlMapper.QuerySingle[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType)
   at Dapper.Tests.Common.DapperEnumValue(IDbConnection connection)
   at Dapper.Tests.MySQLTests.DapperEnumValue_Mysql()
@bgrainger
Copy link
Member Author

bgrainger commented May 12, 2017

The failing line of code is

(AnEnum)connection.QuerySingle<int>("select @v, @y, @z", new { v = AnEnum.B, y = (AnEnum?)AnEnum.B, z = (AnEnum?)null });

Connector/NET returns VARCHAR from GetDataTypeName(2) and typeof(string) from GetFieldType(2). MySqlConnector throws a NotImplementedException in both functions.

@bgrainger bgrainger added the bug label May 13, 2017
@bgrainger bgrainger self-assigned this May 13, 2017
@bgrainger bgrainger added this to the 1.0 milestone May 13, 2017
bgrainger added a commit that referenced this issue May 13, 2017
Handle ColumnType.Null, which can be returned from a query that doesn't
specify data types, e.g., "SELECT NULL".
@bgrainger
Copy link
Member Author

bgrainger commented May 13, 2017

Fixed in 0.19.4

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

No branches or pull requests

1 participant