From fb428c8e43ac9cf2c71652f8f3c12d8c87ba1a3d Mon Sep 17 00:00:00 2001 From: Hajime Nakagami Date: Sun, 31 Mar 2019 11:27:40 +0900 Subject: [PATCH] fix decode result --- lib/firebirdex/query.ex | 9 +++++++-- mix.exs | 2 +- mix.lock | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/firebirdex/query.ex b/lib/firebirdex/query.ex index da2d050..e2a9768 100644 --- a/lib/firebirdex/query.ex +++ b/lib/firebirdex/query.ex @@ -78,8 +78,13 @@ defmodule Firebirdex.Query do def decode(query, result, _opts) do columns = :efirebirdsql_protocol.columns(query.stmt) - rows = Enum.map(result.rows, &(convert_row([], columns, &1))) - %Result{result | rows: rows, num_rows: length(rows)} + + rows = if result.rows == nil do + result.rows + else + Enum.map(result.rows, &(convert_row([], columns, &1))) + end + %Result{result | rows: rows, num_rows: result.num_rows} end end diff --git a/mix.exs b/mix.exs index 46f32f7..aa89b37 100644 --- a/mix.exs +++ b/mix.exs @@ -43,7 +43,7 @@ defmodule Firebirdex.Mixfile do [ {:db_connection, "~> 2.0"}, {:decimal, "~> 1.6"}, - {:efirebirdsql, "~> 0.6.2"}, + {:efirebirdsql, "~> 0.6.3"}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] end diff --git a/mix.lock b/mix.lock index 481ce01..e745020 100644 --- a/mix.lock +++ b/mix.lock @@ -3,7 +3,7 @@ "db_connection": {:hex, :db_connection, "2.0.6", "bde2f85d047969c5b5800cb8f4b3ed6316c8cb11487afedac4aa5f93fd39abfa", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"}, "decimal": {:hex, :decimal, "1.7.0", "30d6b52c88541f9a66637359ddf85016df9eb266170d53105f02e4a67e00c5aa", [:mix], [], "hexpm"}, "earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm"}, - "efirebirdsql": {:hex, :efirebirdsql, "0.6.2", "783af4f8c0d09ec4fbfa3b35d95baab218518ef187d774ab6b64919990003778", [:rebar3], [], "hexpm"}, + "efirebirdsql": {:hex, :efirebirdsql, "0.6.3", "56113806bba3f405893f62c381959cc43f8e5834928ed6f70a326c2a8a3dc5ac", [:rebar3], [], "hexpm"}, "ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},