From 3226b0c15c434a3cbca7f8299aecde0cf7edbc15 Mon Sep 17 00:00:00 2001 From: Ben Kimpel Date: Wed, 1 May 2024 06:02:09 -0500 Subject: [PATCH] Update values.ex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Valim --- lib/myxql/protocol/values.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/myxql/protocol/values.ex b/lib/myxql/protocol/values.ex index a2bfe93..60b35c3 100644 --- a/lib/myxql/protocol/values.ex +++ b/lib/myxql/protocol/values.ex @@ -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