Exqlite.Sqlite3 (Exqlite v0.5.11) View Source

The interface to the NIF implementation.

Link to this section Summary

Functions

Get the number of changes recently.

Closes the database and releases any underlying resources.

Executes an sql script. Multiple stanzas can be passed at once.

Opens a new sqlite database at the Path provided.

Causes the database connection to free as much memory as it can. This is useful if you are on a memory restricted system.

Link to this section Types

Specs

db() :: reference()

Specs

reason() :: atom() | String.t()

Specs

row() :: []

Specs

statement() :: reference()

Link to this section Functions

Link to this function

bind(conn, statement, args)

View Source

Specs

bind(db(), statement(), nil) :: :ok | {:error, reason()}
bind(db(), statement(), []) :: :ok | {:error, reason()}

Specs

changes(db()) :: {:ok, integer()}

Get the number of changes recently.

Note: If triggers are used, the count may be larger than expected.

See: https://sqlite.org/c3ref/changes.html

Specs

close(nil) :: :ok
close(db()) :: :ok | {:error, reason()}

Closes the database and releases any underlying resources.

Link to this function

columns(conn, statement)

View Source

Specs

columns(db(), statement()) :: {:ok, []} | {:error, reason()}

Specs

execute(db(), String.t()) :: :ok | {:error, reason()}

Executes an sql script. Multiple stanzas can be passed at once.

Link to this function

fetch_all(conn, statement)

View Source

Specs

fetch_all(db(), statement()) :: {:ok, [row()]} | {:error, reason()}
Link to this function

fetch_all(conn, statement, chunk_size)

View Source

Specs

fetch_all(db(), statement(), integer()) :: {:ok, [row()]} | {:error, reason()}

Specs

last_insert_rowid(db()) :: {:ok, integer()}
Link to this function

multi_step(conn, statement)

View Source

Specs

multi_step(db(), statement()) :: :busy | {:rows, [row()]} | {:done, [row()]}
Link to this function

multi_step(conn, statement, chunk_size)

View Source

Specs

multi_step(db(), statement(), integer()) ::
  :busy | {:rows, [row()]} | {:done, [row()]}

Specs

open(String.t()) :: {:ok, db()} | {:error, reason()}

Opens a new sqlite database at the Path provided.

If path can be ":memory" to keep the sqlite database in memory.

Specs

prepare(db(), String.t()) :: {:ok, statement()} | {:error, reason()}

Specs

shrink_memory(db()) :: :ok | {:error, reason()}

Causes the database connection to free as much memory as it can. This is useful if you are on a memory restricted system.

Specs

step(db(), statement()) :: :done | :busy | {:row, []}
Link to this function

transaction_status(conn)

View Source

Specs

transaction_status(db()) :: {:ok, :idle | :transaction}