sqlite v1.0.1 Sqlite3Nif

Interact with the SqliteNif nif. Every function in this module will throw a :nif_library_not_loaded error if the nif hasn’t been compiled/loaded.

Link to this section Summary

Types

Args when using bind/5

List of binding args

Database connection Resource. This isn’t a true reference

SQL data

Statement reference. This isn’t a true reference

Functions

Bind paramaters to a prepared statement

Get the number of affected rows of last statement When the statement is executed Dest will receive message {Ref, answer()} with answer :: integer | {:error, term}

Close the connection

Retrieve the column names of the prepared statement

Retrieve the column types of the prepared statement

Enable extension loading

Exec the query. Sends an asynchronous exec command over the connection and returns :ok immediately. When the statement is executed dest will receive message {ref, answer} with answer :: integer | {:error, term}

Finalize a statement

Open the specified sqlite3 database

Prepare a statement

Reset a prepared statement

Start a low level thread which will can handle sqlite3 calls

Link to this section Types

Link to this type bind_arg()
bind_arg() :: atom() | number() | iodata()

Args when using bind/5

Link to this type bind_args()
bind_args() :: [bind_arg()]

List of binding args.

Link to this opaque connection() (opaque)

Database connection Resource. This isn’t a true reference.

Link to this type sql()
sql() :: iodata()

SQL data.

Link to this opaque statement() (opaque)

Statement reference. This isn’t a true reference.

Link to this section Functions

Link to this function bind(db, stmt, ref, dest, args)
bind(connection(), statement(), reference(), pid(), bind_args()) ::
  :ok | error_tup2()

Bind paramaters to a prepared statement.

Link to this function changes(db, ref, dest)
changes(connection(), reference(), pid()) :: :ok | error_tup2()

Get the number of affected rows of last statement When the statement is executed Dest will receive message {Ref, answer()} with answer :: integer | {:error, term}

Link to this function close(db, ref, dest)
close(connection(), reference(), pid()) :: :ok | error_tup2()

Close the connection.

Link to this function column_names(db, stmt, ref, dest)
column_names(connection(), statement(), reference(), pid()) ::
  :ok | error_tup2()

Retrieve the column names of the prepared statement

Link to this function column_types(db, stmt, ref, dest)
column_types(connection(), statement(), reference(), pid()) ::
  :ok | error_tup2()

Retrieve the column types of the prepared statement

Link to this function enable_load_extension(db, ref, dest)
enable_load_extension(connection(), reference(), pid()) :: :ok | error_tup2()

Enable extension loading.

Link to this function exec(db, ref, dest, sql)
exec(connection(), reference(), pid(), sql()) :: :ok | error_tup2()

Exec the query. Sends an asynchronous exec command over the connection and returns :ok immediately. When the statement is executed dest will receive message {ref, answer} with answer :: integer | {:error, term}

Link to this function finalize(db, stmt, ref, dest)
finalize(connection(), statement(), reference(), pid()) :: :ok | error_tup2()

Finalize a statement.

Link to this function insert(db, ref, dest, sql)
insert(connection(), reference(), pid(), sql()) :: :ok | error_tup2()

Insert record

Link to this function multi_step(db, stmt, chunk_size, ref, dest)
multi_step(connection(), statement(), pos_integer(), reference(), pid()) ::
  :ok | error_tup2()
Link to this function open(db, ref, dest, filename, flags)
open(connection(), reference(), pid(), Path.t(), tuple()) :: :ok | error_tup2()

Open the specified sqlite3 database.

Link to this function prepare(db, ref, dest, sql)
prepare(connection(), reference(), pid(), sql()) :: :ok | error_tup2()

Prepare a statement.

Link to this function reset(db, stmt, ref, dest)
reset(connection(), statement(), reference(), pid()) :: :ok | error_tup2()

Reset a prepared statement.

Link to this function start()
start() :: {:ok, connection()} | error_tup2()

Start a low level thread which will can handle sqlite3 calls.