Tds v2.1.1 Tds View Source
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
isolation_level()
View Sourceisolation_level() :: :read_uncommitted | :read_committed | :repeatable_read | :serializable | :snapshot | :no_change
start_option()
View Sourcestart_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()
transaction_option()
View Sourcetransaction_option() :: {:mode, :transaction | :savepoint} | {:isolation_level, isolation_level()} | option()
Link to this section Functions
child_spec(opts)
View Sourcechild_spec([start_option()]) :: Supervisor.Spec.spec()
close(conn, query, opts \\ [])
View Sourceclose(conn(), Tds.Query.t(), [option()]) :: :ok | {:error, Exception.t()}
Decodes MS uniqueidentifier binary to its string representation
Same as decode_uuid/1
but raises ArgumentError
if value is invalid
encode_uuid(value)
View Sourceencode_uuid(any()) :: :error | {:ok, <<_::128>>}
Encodes uuid string into MS uniqueidentifier binary
Same as encode_uuid/1
but raises ArgumentError
if value is invalid
execute(conn, query, params, opts \\ [])
View Sourceexecute(conn(), Tds.Query.t(), list(), [execute_option()]) :: {:ok, Tds.Query.t(), Tds.Result.t()} | {:error, Tds.Error.t()}
execute!(conn, query, params, opts \\ [])
View Sourceexecute!(conn(), Tds.Query.t(), list(), [execute_option()]) :: Tds.Result.t()
Generates a version 4 (random) UUID in the MS uniqueidentifier binary format.
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
.
prepare(conn, statement, opts \\ [])
View Sourceprepare(conn(), iodata(), [option()]) :: {:ok, Tds.Query.t()} | {:error, Exception.t()}
query(conn, statement, params, opts \\ [])
View Sourcequery(conn(), iodata(), list(), [execute_option()]) :: {:ok, Tds.Result.t()} | {:error, Exception.t()}
query!(conn, statement, params, opts \\ [])
View Sourcequery!(conn(), iodata(), list(), [execute_option()]) :: Tds.Result.t() | no_return()
query_multi(conn, statemnt, params, opts \\ [])
View Sourcequery_multi(conn(), iodata(), option(), [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.
rollback(conn, any)
View Sourcerollback(DBConnection.t(), reason :: any()) :: no_return()
start_link(opts \\ [])
View Sourcestart_link([start_option()]) :: {:ok, conn()} | {:error, Tds.Error.t() | term()}
transaction(conn, fun, opts \\ [])
View Sourcetransaction(conn(), (DBConnection.t() -> result), [transaction_option()]) :: {:ok, result} | {:error, any()} when result: var