Skip to content

Commit

Permalink
Update values.ex
Browse files Browse the repository at this point in the history
Co-authored-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
benkimpel and josevalim authored May 1, 2024
1 parent d3b6b18 commit 3226b0c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/myxql/protocol/values.ex
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ defmodule MyXQL.Protocol.Values do
end

def decode_text_value(value, type) when type in [:float, :double] do
value = if String.contains?(value, "."), do: value, else: "#{value}.0"
String.to_float(value)
if String.contains?(value, "."), do: String.to_float(value), else: String.to_integer(value) * 1.0
end

# Note: MySQL implements `NUMERIC` as `DECIMAL`s
Expand Down

0 comments on commit 3226b0c

Please sign in to comment.