Skip to content

Commit

Permalink
Merge pull request elixir-ecto#67 from StoiximanServices/isolation_le…
Browse files Browse the repository at this point in the history
…vel_fix

Fix for SET TRANSACTION_ISOLATION_LEVEL issue
  • Loading branch information
mjaric authored Apr 11, 2018
2 parents c7262dc + 39453d2 commit da6465b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/tds/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ defmodule Tds.Protocol do
val when val in 1..7 -> conn ++ ["SET DATEFIRST #{val}; "]
val -> raise(
ArgumentError,
"set_datefirst: #{val} is out of bounds, valid range is 1..7"
"set_datefirst: #{inspect(val)} is out of bounds, valid range is 1..7"
)
end
end
Expand All @@ -879,7 +879,7 @@ defmodule Tds.Protocol do
conn ++ ["SET DATEFORMAT #{val}; "]
val -> raise(
ArgumentError,
"set_dateformat: #{inspect(val)} has ivalid value, " <>
"set_dateformat: #{inspect(val)} is an invalid value, " <>
"valid values are [:mdy, :dmy, :ymd, :ydm, :myd, :dym]"
)
end
Expand All @@ -896,7 +896,7 @@ defmodule Tds.Protocol do
conn ++ ["SET DEADLOCK_PRIORITY #{val}; "]
val -> raise(
ArgumentError,
"set_deadlock_priority: #{inspect(val)} has ivalid value, " <>
"set_deadlock_priority: #{inspect(val)} is an invalid value, " <>
"valid values are #{inspect([:low, :high, :normal|-10..10])}"
)
end
Expand All @@ -909,7 +909,7 @@ defmodule Tds.Protocol do
conn ++ ["SET LOCK_TIMEOUT #{val}; "]
val -> raise(
ArgumentError,
"set_lock_timeout: #{inspect(val)} has ivalid value, " <>
"set_lock_timeout: #{inspect(val)} is an invalid value, " <>
"must be an positive integer."
)
end
Expand All @@ -923,7 +923,7 @@ defmodule Tds.Protocol do
conn ++ ["SET REMOTE_PROC_TRANSACTIONS #{val}; "]
val -> raise(
ArgumentError,
"set_remote_proc_transactions: #{inspect(val)} has ivalid value, " <>
"set_remote_proc_transactions: #{inspect(val)} is an invalid value, " <>
"should be either :on, :off, nil"
)
end
Expand All @@ -937,7 +937,7 @@ defmodule Tds.Protocol do
conn ++ ["SET IMPLICIT_TRANSACTIONS #{val}; "]
val -> raise(
ArgumentError,
"set_implicit_transactions: #{inspect(val)} has ivalid value, " <>
"set_implicit_transactions: #{inspect(val)} is an invalid value, " <>
"should be either :on, :off, nil"
)
end
Expand All @@ -952,12 +952,11 @@ defmodule Tds.Protocol do
|> Atom.to_string()
|> String.replace("_", " ")
|> String.upcase()
conn ++ ["SET TRANSACTION_ISOLATION_LEVEL #{t}; "]
conn ++ ["SET TRANSACTION ISOLATION LEVEL #{t}; "]
val -> raise(
ArgumentError,
"set_transaction_isolation_level: #{inspect(val)} has ivalid value, " <>
"should be one of [:read_uncommited, :read_commited, :repeatable_read, " <>
":snapshot, :serializable] or nil"
"set_transaction_isolation_level: #{inspect(val)} is an invalid value, " <>
"should be one of #{inspect(@trans_levels)} or nil"
)
end
end
Expand All @@ -971,7 +970,7 @@ defmodule Tds.Protocol do
conn ++ ["ALTER DATABASE [#{database}] SET ALLOW_SNAPSHOT_ISOLATION #{val}; "]
val -> raise(
ArgumentError,
"set_allow_snapshot_isolation: #{inspect(val)} has ivalid value, " <>
"set_allow_snapshot_isolation: #{inspect(val)} is an invalid value, " <>
"should be either :on, :off, nil"
)
end
Expand Down

0 comments on commit da6465b

Please sign in to comment.