changed
hex_metadata.config
|
@@ -4,17 4,17 @@
|
4
4
|
<<"Microsoft SQL Server client (Elixir implementation of the MS TDS protocol)">>}.
|
5
5
|
{<<"elixir">>,<<"~> 1.0">>}.
|
6
6
|
{<<"files">>,
|
7
|
- [<<"lib">>,<<"lib/tds">>,<<"lib/tds/parameter.ex">>,<<"lib/tds/types">>,
|
8
|
- <<"lib/tds/types/uuid.ex">>,<<"lib/tds/binary_utils.ex">>,
|
9
|
- <<"lib/tds/result.ex">>,<<"lib/tds/protocol.ex">>,<<"lib/tds/perf.ex">>,
|
10
|
- <<"lib/tds/protocol">>,<<"lib/tds/protocol/header.ex">>,
|
11
|
- <<"lib/tds/protocol/token.ex">>,<<"lib/tds/protocol/grammar.ex">>,
|
12
|
- <<"lib/tds/protocol/collation.ex">>,<<"lib/tds/tls">>,
|
13
|
- <<"lib/tds/utils.ex">>,<<"lib/tds/versions.ex">>,
|
7
|
[<<"lib">>,<<"lib/tds.ex">>,<<"lib/tds">>,<<"lib/tds/protocol.ex">>,
|
8
|
<<"lib/tds/types">>,<<"lib/tds/types/uuid.ex">>,<<"lib/tds/types.ex">>,
|
9
|
<<"lib/tds/tokens.ex">>,<<"lib/tds/perf.ex">>,<<"lib/tds/latin1.ex">>,
|
10
|
<<"lib/tds/error.ex">>,<<"lib/tds/protocol">>,
|
11
|
<<"lib/tds/protocol/collation.ex">>,<<"lib/tds/protocol/grammar.ex">>,
|
12
|
<<"lib/tds/protocol/token.ex">>,<<"lib/tds/protocol/header.ex">>,
|
13
|
<<"lib/tds/query.ex">>,<<"lib/tds/versions.ex">>,<<"lib/tds/parameter.ex">>,
|
14
|
<<"lib/tds/result.ex">>,<<"lib/tds/errors.csv">>,<<"lib/tds/utils.ex">>,
|
14
15
|
<<"lib/tds/token_descriptors">>,<<"lib/tds/token_descriptors/basic.ex">>,
|
15
|
- <<"lib/tds/error.ex">>,<<"lib/tds/types.ex">>,<<"lib/tds/query.ex">>,
|
16
|
- <<"lib/tds/latin1.ex">>,<<"lib/tds/tokens.ex">>,<<"lib/tds/messages.ex">>,
|
17
|
- <<"lib/tds/errors.csv">>,<<"lib/tds.ex">>,<<"mix.exs">>,<<"README.md">>]}.
|
16
|
<<"lib/tds/binary_utils.ex">>,<<"lib/tds/messages.ex">>,<<"mix.exs">>,
|
17
|
<<"README.md">>]}.
|
18
18
|
{<<"licenses">>,[<<"Apache 2.0">>]}.
|
19
19
|
{<<"links">>,[{<<"Github">>,<<"https://github.com/livehelpnow/tds">>}]}.
|
20
20
|
{<<"name">>,<<"tds">>}.
|
|
@@ -23,7 23,7 @@
|
23
23
|
{<<"name">>,<<"decimal">>},
|
24
24
|
{<<"optional">>,false},
|
25
25
|
{<<"repository">>,<<"hexpm">>},
|
26
|
- {<<"requirement">>,<<"~> 1.6">>}],
|
26
|
{<<"requirement">>,<<"~> 1.9 or ~> 2.0">>}],
|
27
27
|
[{<<"app">>,<<"jason">>},
|
28
28
|
{<<"name">>,<<"jason">>},
|
29
29
|
{<<"optional">>,true},
|
|
@@ -34,4 34,4 @@
|
34
34
|
{<<"optional">>,false},
|
35
35
|
{<<"repository">>,<<"hexpm">>},
|
36
36
|
{<<"requirement">>,<<"~> 2.0">>}]]}.
|
37
|
- {<<"version">>,<<"2.1.3">>}.
|
37
|
{<<"version">>,<<"2.2.0">>}.
|
changed
lib/tds.ex
|
@@ -87,7 87,7 @@ defmodule Tds do
|
87
87
|
Executes statement that can contain multiple sql batches, result will contain
|
88
88
|
all results that server yield for each batch.
|
89
89
|
"""
|
90
|
- @spec query_multi(conn(), iodata(), option(), [execute_option]) ::
|
90
|
@spec query_multi(conn, iodata, list, [execute_option]) ::
|
91
91
|
{:ok, resultset()}
|
92
92
|
| {:error, Exception.t()}
|
93
93
|
def query_multi(conn, statemnt, params, opts \\ []) do
|
changed
lib/tds/protocol.ex
|
@@ -23,7 23,7 @@ defmodule Tds.Protocol do
|
23
23
|
:serializable
|
24
24
|
]
|
25
25
|
|
26
|
- @type sock :: {:gen_tcp | :ssl, pid}
|
26
|
@type sock :: {:gen_tcp | :ssl, :gen_tcp.socket() | :ssl.sslsocket()}
|
27
27
|
@type env :: %{
|
28
28
|
trans: <<_::8>>,
|
29
29
|
savepoint: non_neg_integer,
|
changed
lib/tds/types.ex
|
@@ -714,9 714,9 @@ defmodule Tds.Types do
|
714
714
|
size = byte_size(value)
|
715
715
|
<<value::little-size(size)-unit(8)>> = value
|
716
716
|
|
717
|
- Decimal.get_context()
|
717
|
Decimal.Context.get()
|
718
718
|
|> Map.put(:precision, precision)
|
719
|
- |> Decimal.set_context()
|
719
|
|> Decimal.Context.set()
|
720
720
|
|
721
721
|
case sign do
|
722
722
|
0 -> Decimal.new(-1, value, -scale)
|
|
@@ -887,9 887,9 @@ defmodule Tds.Types do
|
887
887
|
end
|
888
888
|
|
889
889
|
def encode_decimal_type(%Parameter{value: value}) do
|
890
|
- d_ctx = Decimal.get_context()
|
890
|
d_ctx = Decimal.Context.get()
|
891
891
|
d_ctx = %{d_ctx | precision: 38}
|
892
|
- Decimal.set_context(d_ctx)
|
892
|
Decimal.Context.set(d_ctx)
|
893
893
|
|
894
894
|
value_list =
|
895
895
|
value
|
|
@@ -942,9 942,9 @@ defmodule Tds.Types do
|
942
942
|
end
|
943
943
|
|
944
944
|
def encode_float_type(%Parameter{value: �cimal{} = value}) do
|
945
|
- d_ctx = Decimal.get_context()
|
945
|
d_ctx = Decimal.Context.get()
|
946
946
|
d_ctx = %{d_ctx | precision: 38}
|
947
|
- Decimal.set_context(d_ctx)
|
947
|
Decimal.Context.set(d_ctx)
|
948
948
|
|
949
949
|
value_list =
|
950
950
|
value
|
|
@@ -1129,9 1129,9 @@ defmodule Tds.Types do
|
1129
1129
|
end
|
1130
1130
|
|
1131
1131
|
def encode_decimal_descriptor(%Parameter{value: �cimal{} = dec}) do
|
1132
|
- d_ctx = Decimal.get_context()
|
1132
|
d_ctx = Decimal.Context.get()
|
1133
1133
|
d_ctx = %{d_ctx | precision: 38}
|
1134
|
- Decimal.set_context(d_ctx)
|
1134
|
Decimal.Context.set(d_ctx)
|
1135
1135
|
|
1136
1136
|
value_list =
|
1137
1137
|
dec
|
|
@@ -1251,9 1251,9 @@ defmodule Tds.Types do
|
1251
1251
|
end
|
1252
1252
|
|
1253
1253
|
def encode_data(@tds_data_type_floatn, value, _) do
|
1254
|
- # d_ctx = Decimal.get_context()
|
1254
|
# d_ctx = Decimal.Context.get()
|
1255
1255
|
# d_ctx = %{d_ctx | precision: 38}
|
1256
|
- # Decimal.set_context(d_ctx)
|
1256
|
# Decimal.Context.set(d_ctx)
|
1257
1257
|
|
1258
1258
|
# value_list =
|
1259
1259
|
# value
|
|
@@ -1282,9 1282,9 @@ defmodule Tds.Types do
|
1282
1282
|
|
1283
1283
|
# decimal
|
1284
1284
|
def encode_data(@tds_data_type_decimaln, �cimal{} = value, attr) do
|
1285
|
- d_ctx = Decimal.get_context()
|
1285
|
d_ctx = Decimal.Context.get()
|
1286
1286
|
d_ctx = %{d_ctx | precision: 38}
|
1287
|
- Decimal.set_context(d_ctx)
|
1287
|
Decimal.Context.set(d_ctx)
|
1288
1288
|
precision = attr[:precision]
|
1289
1289
|
|
1290
1290
|
d =
|
|
@@ -1351,7 1351,7 @@ defmodule Tds.Types do
|
1351
1351
|
end
|
1352
1352
|
|
1353
1353
|
def encode_data(@tds_data_type_timen, value, _attr) do
|
1354
|
- # Logger.debug "encode_data_timen"
|
1354
|
# Logger.debug"encode_data_timen"
|
1355
1355
|
{data, scale} = encode_time(value)
|
1356
1356
|
# Logger.debug "#{inspect data}"
|
1357
1357
|
if data == nil do
|
changed
mix.exs
|
@@ -2,26 2,19 @@ defmodule Tds.Mixfile do
|
2
2
|
@moduledoc false
|
3
3
|
use Mix.Project
|
4
4
|
|
5
|
- @version "2.1.3"
|
5
|
@version "2.2.0"
|
6
6
|
def project do
|
7
7
|
[
|
8
8
|
app: :tds,
|
9
9
|
version: @version,
|
10
10
|
elixir: "~> 1.0",
|
11
11
|
deps: deps(),
|
12
|
- test_coverage: [tool: ExCoveralls],
|
13
|
- preferred_cli_env: [
|
14
|
- coveralls: :test,
|
15
|
- "coveralls.detail": :test,
|
16
|
- "coveralls.post": :test,
|
17
|
- "coveralls.html": :test
|
18
|
- ],
|
19
12
|
description: description(),
|
20
13
|
package: package(),
|
21
14
|
xref: [exclude: [:ssl]],
|
22
15
|
rustler_crates: [
|
23
16
|
tds_encoding: [
|
24
|
- mode: (if Mix.env() == :prod, do: :release, else: :debug)
|
17
|
mode: if(Mix.env() == :prod, do: :release, else: :debug)
|
25
18
|
]
|
26
19
|
],
|
27
20
|
|
|
@@ -48,15 41,12 @@ defmodule Tds.Mixfile do
|
48
41
|
|
49
42
|
defp deps do
|
50
43
|
[
|
51
|
- {:credo, "~> 0.8", only: [:dev, :test], runtime: false},
|
52
44
|
{:binpp, ">= 0.0.0", only: [:dev, :test]},
|
53
|
- {:decimal, "~> 1.6"},
|
45
|
{:decimal, "~> 1.9 or ~> 2.0"},
|
54
46
|
{:jason, "~> 1.0", optional: true},
|
55
47
|
{:db_connection, "~> 2.0"},
|
56
|
- {:dialyxir, "~> 0.5", only: [:dev], runtime: false},
|
57
|
- {:excoveralls, "~> 0.7", only: :test},
|
58
48
|
{:ex_doc, "~> 0.19", only: :dev},
|
59
|
- {:tds_encoding, "~> 1.0", optional: true, only: :test},
|
49
|
{:tds_encoding, "~> 1.1", optional: true, only: :test},
|
60
50
|
{:tzdata, "~> 1.0", optional: true, only: :test}
|
61
51
|
]
|
62
52
|
end
|