Skip to content

Commit d87a3a5

Browse files
Add test that raise handle exception
1 parent b433d31 commit d87a3a5

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

test/handle0_test.exs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
defmodule Handle0Test do
2+
3+
use ExUnit.Case, async: true
4+
5+
import Tds.TestHelper
6+
7+
alias Tds
8+
9+
@tag timeout: 50000
10+
@table "foo"
11+
12+
setup do
13+
opts = Application.fetch_env!(:tds, :opts)
14+
{:ok, pid} = Tds.start_link(opts)
15+
16+
{:ok, [pid: pid]}
17+
end
18+
19+
test "Could not find prepared statement with handle 0.", %{pid: pid} = context do
20+
query("DROP TABLE #{@table}", [])
21+
22+
query(
23+
"""
24+
CREATE TABLE #{@table}(
25+
[id] int identity(1,1) not null primary key
26+
)
27+
""",
28+
[]
29+
)
30+
31+
n = 300
32+
for i <- 1..n do
33+
result =
34+
Tds.query(pid, "SELECT * FROM #{@table} WHERE id = @id", [
35+
%Tds.Parameter{name: "@id", value: "7", type: :int}
36+
])
37+
38+
assert {i, {:ok,_}} = {i, result}
39+
end
40+
41+
query("DROP TABLE #{@table}", [])
42+
end
43+
end

0 commit comments

Comments
 (0)