Skip to content

Commit

Permalink
Add support for float values in DecimalColumnType (JetBrains#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaasasolut authored and Tapac committed Nov 21, 2017
1 parent 69ffa6c commit 871d74e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/org/jetbrains/exposed/sql/ColumnType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class DecimalColumnType(val precision: Int, val scale: Int): ColumnType() {
return when (valueFromDB) {
is BigDecimal -> valueFromDB.setScale(scale, RoundingMode.HALF_EVEN)
is Double -> BigDecimal.valueOf(valueFromDB).setScale(scale, RoundingMode.HALF_EVEN)
is Float -> BigDecimal(java.lang.Float.toString(valueFromDB)).setScale(scale, RoundingMode.HALF_EVEN)
is Int -> BigDecimal(valueFromDB)
is Long -> BigDecimal.valueOf(valueFromDB)
else -> valueFromDB
Expand Down

0 comments on commit 871d74e

Please sign in to comment.