Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit ca7166d

Browse files
committed
fix decimal scale and precision parsing
1 parent 2878c09 commit ca7166d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/sqlitex/row.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ defmodule Sqlitex.Row do
5353
end
5454
defp translate_value({float, "decimal"}), do: Decimal.new(float)
5555
defp translate_value({float, "decimal(" <> rest}) do
56-
[precision, scale] = rest |> string_rstrip(?)) |> String.split(",") |> Enum.map(&String.to_integer/1)
56+
[precision, scale] = rest |> string_rstrip(?)) |> String.split(",") |> Enum.map(&(&1 |> String.trim() |> String.to_integer))
5757
Decimal.with_context %Decimal.Context{precision: precision, rounding: :down}, fn ->
5858
float |> Float.round(scale) |> Float.to_string |> Decimal.new |> Decimal.plus
5959
end

0 commit comments

Comments
 (0)