View Source Tds (Tds v2.3.1)
Microsoft SQL Server driver for Elixir.
Tds is partial implementation of the Micorosoft SQL Server MS-TDS Tabular Data Stream Protocol.
A Tds query is performed in separate server-side prepare and execute stages.
At the moment query handle is not reused, but there is plan to cahce handles in
near feature. It uses RPC
requests by default to Sp_Prepare
(ProcId=11) and Sp_Execute
(ProcId=12)
query, but it is possible to configure driver to use only Sp_ExecuteSql.
Please consult with configuration how to do this.
Link to this section Summary
Functions
Decodes MS uniqueidentifier binary to its string representation.
Same as decode_uuid/1
but raises ArgumentError
if value is invalid.
Encodes UUID string into MS uniqueidentifier binary.
Same as encode_uuid/1
but raises ArgumentError
if value is invalid.
Generates a version 4 (random) UUID in the MS uniqueidentifier binary format.
Returns the configured JSON library.
Executes statement that can contain multiple SQL batches, result will contain all results that server yield for each batch.
Link to this section Types
Specs
conn() :: DBConnection.conn()
Specs
Specs
isolation_level() :: :read_uncommitted | :read_committed | :repeatable_read | :serializable | :snapshot | :no_change
Specs
option() :: DBConnection.option()
Specs
resultset() :: [Tds.Result.t()]
Specs
start_option() :: {:hostname, String.t()} | {:port, :inet.port_number()} | {:database, String.t()} | {:username, String.t()} | {:password, String.t()} | {:timeout, timeout()} | {:connect_timeout, timeout()} | DBConnection.start_option()
Specs
transaction_option() :: {:mode, :transaction | :savepoint} | {:isolation_level, isolation_level()} | option()
Link to this section Functions
Specs
child_spec([start_option()]) :: Supervisor.Spec.spec()
Specs
close(conn(), Tds.Query.t(), [option()]) :: :ok | {:error, Exception.t()}
Specs
close!(conn(), Tds.Query.t(), [option()]) :: :ok
Decodes MS uniqueidentifier binary to its string representation.
Same as decode_uuid/1
but raises ArgumentError
if value is invalid.
Specs
encode_uuid(any()) :: :error | {:ok, <<_::128>>}
Encodes UUID string into MS uniqueidentifier binary.
Specs
encode_uuid!(any()) :: <<_::128>>
Same as encode_uuid/1
but raises ArgumentError
if value is invalid.
Specs
execute(conn(), Tds.Query.t(), list(), [execute_option()]) :: {:ok, Tds.Query.t(), Tds.Result.t()} | {:error, Tds.Error.t()}
Specs
execute!(conn(), Tds.Query.t(), list(), [execute_option()]) :: Tds.Result.t()
Specs
generate_uuid() :: <<_::128>>
Generates a version 4 (random) UUID in the MS uniqueidentifier binary format.
Specs
json_library() :: module()
Returns the configured JSON library.
To customize the JSON library, include the following in your config/config.exs
:
config :tds, json_library: SomeJSONModule
Defaults to Jason
.
Specs
prepare(conn(), iodata(), [option()]) :: {:ok, Tds.Query.t()} | {:error, Exception.t()}
Specs
prepare!(conn(), iodata(), [option()]) :: Tds.Query.t() | no_return()
Specs
query(conn(), iodata(), list(), [execute_option()]) :: {:ok, Tds.Result.t()} | {:error, Exception.t()}
Specs
query!(conn(), iodata(), list(), [execute_option()]) :: Tds.Result.t() | no_return()
Specs
query_multi(conn(), iodata(), list(), [execute_option()]) :: {:ok, resultset()} | {:error, Exception.t()}
Executes statement that can contain multiple SQL batches, result will contain all results that server yield for each batch.
Specs
rollback(DBConnection.t(), reason :: any()) :: no_return()
Specs
start_link([start_option()]) :: {:ok, conn()} | {:error, Tds.Error.t() | term()}
Specs
transaction(conn(), (DBConnection.t() -> result), [transaction_option()]) :: {:ok, result} | {:error, any()} when result: var