Skip to content

Commit

Permalink
Query should now return :disconnect on connection failures. 0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jae Bach Hardie committed Mar 29, 2017
1 parent 417764a commit 5a3ad43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mssqlex/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Mssqlex.Error do
defp translate("42S01"), do: :base_table_or_view_already_exists
defp translate("42S02"), do: :base_table_or_view_not_found
defp translate("28000"), do: :invalid_authorization
defp translate("42000"), do: :syntax_error_or_access_violation
defp translate("08" <> _), do: :connection_exception
defp translate(code), do: code

defp get_constraint_violations(reason) do
Expand Down
3 changes: 3 additions & 0 deletions lib/mssqlex/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ defmodule Mssqlex.Protocol do
with {:ok, new_state} <- switch_auto_commit(:on, state),
do: handle_execute(query, params, opts, new_state)
end
{:error,
%Mssqlex.Error{odbc_code: :connection_exception} = reason} ->
{:disconnect, reason, state}
{:error, reason} ->
{:error, reason, state}
{:selected, columns, rows} ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Mssqlex.Mixfile do

def project do
[app: :mssqlex,
version: "0.6.2",
version: "0.6.3",
description: "Adapter to Microsoft SQL Server. Using DBConnection and ODBC.",
elixir: "~> 1.4",
build_embedded: Mix.env == :prod,
Expand Down

0 comments on commit 5a3ad43

Please sign in to comment.