View Source Snowpack.ODBC (Snowpack v0.7.0)
Adapter to Erlang's :odbc
module.
This module is a GenServer that handles communication between Elixir
and Erlang's :odbc
module.
It is used by Snowpack.Protocol
and should not generally be
accessed directly.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Disconnects from the ODBC driver.
Callback implementation for GenServer.init/1
.
Sends a parametrized query to the ODBC driver.
Starts the connection process to the ODBC driver.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec describe_result(pid(), iodata()) :: {:selected, [binary()], [tuple()]} | {:error, Snowpack.Error.t()}
@spec disconnect(pid()) :: :ok
Disconnects from the ODBC driver.
pid
is the :odbc
process id
Callback implementation for GenServer.init/1
.
@spec query(pid(), iodata(), Keyword.t(), Keyword.t(), boolean()) :: {:selected, [binary()], [tuple()]} | {:selected, [binary()], [tuple()], [{binary()}]} | {:updated, non_neg_integer()} | {:error, Snowpack.Error.t()}
Sends a parametrized query to the ODBC driver.
Interface to :odbc.param_query/3
.See
Erlang's ODBC guide
for usage details and examples.
pid
is the:odbc
process idstatement
is the SQL query stringparams
are the parameters to send with the SQL queryopts
are options to be passed on to:odbc
timeout
in millisecods (defaults to 2 minutes)
with_query_id
runs query in transaction and selects LAST_QUERY_ID()
Starts the connection process to the ODBC driver.
conn_str
should be a connection string in the format required by your ODBC driver.
opts
will be passed verbatim to :odbc.connect/2
.