Skip to content

Commit 49452a8

Browse files
committed
Have the same casts in GetDecimal as in GetDouble
Signed-off-by: Daniel Cohen Gindi <[email protected]>
1 parent 7159b63 commit 49452a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/MySqlConnector/Core/Row.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,13 @@ public Stream GetStream(int ordinal)
350350

351351
public string GetString(int ordinal) => (string) GetValue(ordinal);
352352

353-
public decimal GetDecimal(int ordinal) => (decimal) GetValue(ordinal);
353+
public decimal GetDecimal(int ordinal)
354+
{
355+
var value = GetValue(ordinal);
356+
return value is float floatValue ? (decimal) floatValue :
357+
value is double decimalValue ? (decimal) decimalValue :
358+
(decimal) value;
359+
}
354360

355361
public double GetDouble(int ordinal)
356362
{

0 commit comments

Comments
 (0)