Adapter module for Oracle. DBConnection behaviour implementation.

It uses orax for communicating to the database.

Summary

Functions

Returns the configured JSON library.

Runs the SQL statement.

Starts and links to a database connection process.

Strip single/multiline comments

Functions

json_library()

@spec json_library() :: module()

Returns the configured JSON library.

To customize the JSON library, include the following in your config/config.exs:

config :orax, :json_library, SomeJSONModule

Defaults to Elixir's built-in JSON. The module must provide encode!/1 and decode!/1, as Jason does.

query(conn, sql, params \\ [])

@spec query(conn :: any(), sql :: any(), params :: any()) ::
  {:ok | :cont, any()} | {:error | :disconnect, any()}

Runs the SQL statement.

See DBConnection.prepare_execute/4.

In case of success, it must return an :ok tuple containing a map with at least two keys:

  • :num_rows - the number of rows affected
  • :rows - the result set as a list

start_link(opts)

@spec start_link(opts :: Keyword.t()) :: {:ok, pid()} | {:error, any()}

Starts and links to a database connection process.

See Ecto.Adapters.Orax.

By default the DBConnection starts a pool with a single connection. The size of the pool can be increased with :pool_size. The ping interval to validate an idle connection can be given with the :idle_interval option.

strip(sql)

@spec strip(sql :: String.t()) :: String.t()

Strip single/multiline comments