sqlite v1.0.0 Sqlite

Use a Sqlite3 database in Elixir and Erlang!

Link to this section Summary

Types

Connection record

File to open

Statement record

SQL binary or charlist

Functions

Bind values to prepared statements

Bind values to prepared statements

Return the number of affected rows of last statement

Return the number of affected rows of last statement

Close the database connection

Close the database connection

Return the column names of the prepared statement

Return the column names of the prepared statement

Return the column types of the prepared statement

Return the column types of the prepared statement

Enable the database to load extensions

Enable the database to load extensions

Execute sql statement, returns the number of affected rows

Execute SQL statement and bind params to it

Execute SQL statement and bind params to it

Return the results after enumerating an entire statement

Return the results of stepping into a statement

Apply a function over the results of SQL query

Insert records, returns the last rowid

Insert records, returns the last rowid

Enumerate sql applying f to each result

Opens a sqlite3 database mentioned in filename

Opens a sqlite3 database mentioned in filename with flags

Opens a sqlite3 database with a flags tuple and a timeout

Prepare a statement

Prepare a statement

Execute a sql statement, returns a list with tuples

Execute a sql statement, returns a list with tuples

Reset the prepared statement back to its initial state

Reset the prepared statement back to its initial state

Step into a prepared statement

Step into a prepared statement

Link to this section Types

Link to this type connection()
connection() :: {:connection, reference(), Sqlite3Nif.connection()}

Connection record.

Link to this type filename()
filename() :: Path.t() | iodata()

File to open.

Link to this type prepared_statement()
prepared_statement() :: {:statement, Sqlite3Nif.statement(), connection()}

Statement record.

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

SQL binary or charlist.

Link to this section Functions

Link to this function bind(prepared_statement, args)
bind(prepared_statement(), Sqlite3Nif.bind_args()) :: :ok | error_tup2()

Bind values to prepared statements

Link to this function bind(prepared_statement, args, timeout)
bind(prepared_statement(), Sqlite3Nif.bind_args(), timeout()) ::
  :ok | error_tup2()

Bind values to prepared statements

Link to this function changes(connection)
changes(connection()) :: integer() | error_tup2()

Return the number of affected rows of last statement.

Link to this function changes(connection, timeout)
changes(connection(), timeout()) :: {:ok, integer()} | error_tup2()

Return the number of affected rows of last statement.

Link to this function close(connection)
close(connection()) :: :ok | error_tup2()

Close the database connection.

Link to this function close(connection, timeout)
close(connection(), timeout()) :: :ok | error_tup2()

Close the database connection.

Link to this function column_names(prepared_statement)
column_names(prepared_statement()) :: tuple() | error_tup2()

Return the column names of the prepared statement.

Link to this function column_names(prepared_statement, timeout)
column_names(prepared_statement(), timeout()) :: tuple() | error_tup2()

Return the column names of the prepared statement.

Link to this function column_types(prepared_statement)
column_types(prepared_statement()) :: tuple() | error_tup2()

Return the column types of the prepared statement.

Link to this function column_types(prepared_statement, timeout)
column_types(prepared_statement(), timeout()) :: tuple() | error_tup2()

Return the column types of the prepared statement.

Link to this function enable_load_extension(connection)
enable_load_extension(connection()) :: :ok | error_tup2()

Enable the database to load extensions

Link to this function enable_load_extension(connection, timeout)
enable_load_extension(connection(), timeout()) :: :ok | error_tup2()

Enable the database to load extensions

Link to this function exec(sql, connection)
exec(sql(), connection()) :: :ok | error_tup2()

Execute sql statement, returns the number of affected rows.

Link to this function exec(sql, connection, timeout)
exec(sql(), connection(), timeout()) :: :ok | error_tup2()
exec(sql(), Sqlite3Nif.bind_args(), connection()) :: :ok | error_tup2()

Execute SQL statement and bind params to it.

Link to this function exec(sql, params, connection, timeout)
exec(sql(), Sqlite3Nif.bind_args(), connection(), timeout()) ::
  :ok | error_tup2()

Execute SQL statement and bind params to it.

Link to this function fetchall(statement)

Return the results after enumerating an entire statement.

Link to this function fetchone(statement)

Return the results of stepping into a statement.

Link to this function foreach(f, sql, connection)

Apply a function over the results of SQL query.

Link to this function insert(sql, connection)
insert(sql(), connection()) :: {:ok, integer()} | error_tup2()

Insert records, returns the last rowid.

Link to this function insert(sql, connection, timeout)
insert(sql(), connection(), timeout()) :: {:ok, integer()} | error_tup2()

Insert records, returns the last rowid.

Link to this function map(f, sql, connection)

Enumerate sql applying f to each result.

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

Opens a sqlite3 database mentioned in filename.

Link to this function open(filename, flags)

Opens a sqlite3 database mentioned in filename with flags.

Link to this function open(filename, flags, timeout)
open(filename(), tuple(), timeout()) :: {:ok, connection()} | error_tup2()

Opens a sqlite3 database with a flags tuple and a timeout.

Link to this function prepare(sql, connection)
prepare(sql(), connection()) :: {:ok, prepared_statement()} | error_tup2()

Prepare a statement

Link to this function prepare(sql, connection, timeout)
prepare(sql(), connection(), timeout()) ::
  {:ok, prepared_statement()} | error_tup2()

Prepare a statement

Link to this function q(sql, connection)

Execute a sql statement, returns a list with tuples.

Link to this function q(sql, args, connection)

Execute a sql statement, returns a list with tuples.

Link to this function reset(prepared_statement)
reset(prepared_statement()) :: :ok | error_tup2()

Reset the prepared statement back to its initial state.

Link to this function reset(prepared_statement, timeout)
reset(prepared_statement(), timeout()) :: :ok | error_tup2()

Reset the prepared statement back to its initial state.

Link to this function step(prepared_statement)

Step into a prepared statement.

Link to this function step(prepared_statement, timeout)
step(prepared_statement(), timeout()) ::
  :"$busy" | :"$done" | {:row, any()} | error_tup2()

Step into a prepared statement.