You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Software versions
MySqlConnector version: 2.2.7
Server type (MySQL, MariaDB, Aurora, etc.) and version: MySQL 8.0
.NET version: 7.0
Describe the bug
MySqlDataReader.GetMySqlDecimal can't read a value from a column with the ZEROFILL attribute.
Exception
FormatException: Could not parse the value as a MySqlDecimal: 0000000000.0000000000
at MySqlConnector.MySqlDecimal..ctor(String value) in C:\Code\MySql\MySqlConnector\src\MySqlConnector\MySqlDecimal.cs:line 46
at MySqlConnector.Core.Row.GetMySqlDecimal(Int32 ordinal) in C:\Code\MySql\MySqlConnector\src\MySqlConnector\Core\Row.cs:line 415
at MySqlConnector.MySqlDataReader.GetMySqlDecimal(Int32 ordinal) in C:\Code\MySql\MySqlConnector\src\MySqlConnector\MySqlDataReader.cs:line 276
at UserQuery.Main(), line 33
Code sample
droptable if exists dectest;
createtabledectest(value decimal(20,10) zerofill);
insert into dectest(value) values(0),(1),(0.1);
usingvarcmd=new MySqlCommand("select value from dectest", connection);usingvarreader= cmd.ExecuteReader();while(reader.Read())
reader.GetMySqlDecimal(0).Dump();
If you wanted to parse these zerofilled decimals using .NET primitives and truncate it, that's possible, but from testing we could only support precision up to about 29/30 digits.
Software versions
MySqlConnector version: 2.2.7
Server type (MySQL, MariaDB, Aurora, etc.) and version: MySQL 8.0
.NET version: 7.0
Describe the bug
MySqlDataReader.GetMySqlDecimal
can't read a value from a column with theZEROFILL
attribute.Exception
Code sample
Expected behavior
Reads the column value as a
MySqlDecimal
.Additional context
Reported here: #1075 (comment)
The text was updated successfully, but these errors were encountered: