Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos, compiler warning and improve language #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/tds.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ defmodule Tds do
@spec query_multi(conn, iodata, list, [execute_option]) ::
{:ok, resultset()}
| {:error, Exception.t()}
def query_multi(conn, statemnt, params, opts \\ []) do
query = %Query{statement: statemnt}
def query_multi(conn, statement, params, opts \\ []) do
query = %Query{statement: statement}

opts =
opts
Expand Down
11 changes: 7 additions & 4 deletions lib/tds/binary_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,22 @@ defmodule Tds.BinaryUtils do
defmacro int64, do: quote(do: signed - 64)

@doc """
A 8-bit signed unsigned integer.
A 8-bit unsigned integer.
"""
defmacro uint8, do: quote(do: unsigned - 8)

@doc """
A 16-bit signed unsigned integer.
A 16-bit unsigned integer.
"""
defmacro uint16, do: quote(do: unsigned - 16)

@doc """
A 32-bit signed unsigned integer.
A 32-bit unsigned integer.
"""
defmacro uint32, do: quote(do: unsigned - 32)

@doc """
A 64-bit signed unsigned integer.
A 64-bit unsigned integer.
"""
defmacro uint64, do: quote(do: unsigned - 64)

Expand All @@ -199,6 +199,9 @@ defmodule Tds.BinaryUtils do
"""
defmacro float64, do: quote(do: signed - float - 64)

@doc """
A 32-bit signed float.
"""
defmacro float32, do: quote(do: signed - float - 32)

defmacro binary(size), do: quote(do: binary - size(unquote(size)))
Expand Down
2 changes: 1 addition & 1 deletion lib/tds/encoding/latin1.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Tds.Encoding.Latin1 do
def encode(str, encoding) when is_binary(str) do
raise Tds.Error,
"`Tds.Encoding.Latin1` does not support encoding `#{encoding}`. " <>
"Please set `:text_encoder` in your config.exs to a module supports it."
"Please set `:text_encoder` in your config.exs to a module that supports it."
end

def decode(binary, "utf-16le") when is_binary(binary) do
Expand Down
4 changes: 2 additions & 2 deletions lib/tds/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Tds.Error do
## Usage

iex> raise Tds.Error
** (Tds.Error) An error occured.
** (Tds.Error) An error occurred.

iex> raise Tds.Error, "some error"
** (Tds.Error) some error
Expand Down Expand Up @@ -63,7 +63,7 @@ defmodule Tds.Error do
regex = String.replace_trailing(regex, "\n", "")

if code == nil do
raise CompileError, "Error code must be integer value"
raise CompileError, "Error code must be an integer value"
end

{code, {type, regex}}
Expand Down
4 changes: 2 additions & 2 deletions lib/tds/parameter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ defmodule Tds.Parameter do
end

def fix_data_type(%__MODULE__{type: nil, value: nil} = param) do
# should fix ecto has_one, on_change :nulify issue where type is not know when ecto
# build query/statement for on_chage callback
# should fix Ecto has_one, on_change :nullify issue where type is not known when Ecto
# builds query/statement for on_change callback
%{param | type: :binary}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tds/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ defmodule Tds.Protocol do
server =
data
|> String.split(";;")
|> Enum.slice(0..-2)
|> Enum.slice(0..-2//-1)
|> Enum.reduce([], fn str, acc ->
server =
str
Expand Down
6 changes: 3 additions & 3 deletions lib/tds/protocol/prelogin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule Tds.Protocol.Prelogin do
# @trace_id_token 0x05
@fed_auth_required_token 0x06
@nonce_opt_token 0x07
@termintator_token 0xFF
@terminator_token 0xFF

# Encryption flags
@encryption_off 0x00
Expand Down Expand Up @@ -69,7 +69,7 @@ defmodule Tds.Protocol.Prelogin do

{iodata, _} =
stream
|> Enum.reduce({[[], @termintator_token, []], start_offset}, fn
|> Enum.reduce({[[], @terminator_token, []], start_offset}, fn
{token, option_data}, {[options, term, data], offset} ->
data_length = byte_size(option_data)

Expand Down Expand Up @@ -265,7 +265,7 @@ defmodule Tds.Protocol.Prelogin do
end

defp decode_tokens(
<<@termintator_token, tail::binary>>,
<<@terminator_token, tail::binary>>,
tokens,
_s
) do
Expand Down