Module esqlite3_nif

Low level Erlang API for sqlite3 databases.

Copyright © 2011 - 2022 Maas-Maarten Zeeman

Authors: Maas-Maarten Zeeman (mmzeeman@xs4all.nl).

Description

Low level Erlang API for sqlite3 databases.

Data Types

cell()

cell() = undefined | integer() | float() | binary()

error()

error() = {error, extended_errcode()}

error_info()

error_info() = #{errcode := integer(), extended_errcode := extended_errcode(), errstr := unicode:unicode_binary(), errmsg := unicode:unicode_binary(), error_offset := integer()}

esqlite3_backup_ref()

esqlite3_backup_ref() = reference()

Reference to a online backup object. See https://sqlite.org/c3ref/backup.html for more details.

esqlite3_ref()

esqlite3_ref() = reference()

Reference to a database connection handle. See https://sqlite.org/c3ref/sqlite3.html for more details.

esqlite3_stmt_ref()

esqlite3_stmt_ref() = reference()

Reference to a prepared statement object. See https://sqlite.org/c3ref/stmt.html for more details.

extended_errcode()

extended_errcode() = integer()

Extended sqlite3 error code. See https://sqlite.org/rescode.html for more details.

row()

row() = [cell()]

rowid()

rowid() = integer()

sql()

sql() = iodata()

Make sure the iodata contains utf-8 encoded data.

Function Index

open/1Open the specified sqlite3 database.
close/1Close the connection.
error_info/1Get an error messages for the last occurred error.
set_update_hook/2Set an update hook.
exec/2Execute a sql statement.
prepare/3Compile a sql statement.
bind_int/3Bind an integer to a position in a prepared statement.
bind_int64/3Bind a 64 bit integer to a position in a prepared statement.
bind_double/3Bind an double/float to a position in a prepared statement.
bind_text/3Bind a utf-8 string to a position in a prepared statement.
bind_blob/3Bind a blob to a position in a prepared statement.
bind_null/2Bind a null to a position in a prepared statement.
bind_parameter_index/2
step/1
reset/1
column_names/1Retrieve the column names of the prepared statement.
column_decltypes/1Retrieve the declared datatypes of all columns.
backup_init/4Initialize a backup procedure of a database.
backup_remaining/1
backup_pagecount/1
backup_step/2
backup_finish/1
interrupt/1Interrupt all active queries.
last_insert_rowid/1Get the last insert rowid.
changes/1Get number of changes insert, delete of the most recent completed INSERT, DELETE or UPDATE statement.
get_autocommit/1Get autocommit.
memory_stats/1Get memory statistics.
status/2Get sqlite status information.

Function Details

open/1

open(Filename) -> OpenResult

Open the specified sqlite3 database. It is possible to use sqlite's uri filenames to open files. See: https://sqlite.org/uri.html for more information.

close/1

close(Connection) -> CloseResult

Close the connection.

error_info/1

error_info(Connection) -> ErrorInfo

Get an error messages for the last occurred error.

set_update_hook/2

set_update_hook(Connection, Pid) -> Result

Set an update hook

exec/2

exec(Connection, Sql) -> ExecResult

Execute a sql statement

prepare/3

prepare(Connection, Sql, PrepareFlags) -> PrepareResult

Compile a sql statement.

bind_int/3

bind_int(Statement, Index, Value) -> Result

Bind an integer to a position in a prepared statement.

bind_int64/3

bind_int64(Statement, Index, Value) -> Result

Bind a 64 bit integer to a position in a prepared statement.

bind_double/3

bind_double(Statement, Index, Value) -> Result

Bind an double/float to a position in a prepared statement.

bind_text/3

bind_text(Statement, Index, Value) -> Result

Bind a utf-8 string to a position in a prepared statement.

bind_blob/3

bind_blob(Statement, Index, Value) -> Result

Bind a blob to a position in a prepared statement.

bind_null/2

bind_null(Statement, Index) -> Result

Bind a null to a position in a prepared statement.

bind_parameter_index/2

bind_parameter_index(Statement, ParameterName) -> Result

step/1

step(Statement) -> StepResult

reset/1

reset(Statement) -> ResetResult

column_names/1

column_names(Statement) -> Names

Retrieve the column names of the prepared statement

column_decltypes/1

column_decltypes(Statement) -> Types

Retrieve the declared datatypes of all columns.

backup_init/4

backup_init(Destination, DestinationName, Source, SourceName) -> InitResult

Initialize a backup procedure of a database.

backup_remaining/1

backup_remaining(Backup) -> Remaining

backup_pagecount/1

backup_pagecount(Backup) -> Pagecount

backup_step/2

backup_step(Backup, NPage) -> Result

backup_finish/1

backup_finish(Backup) -> Result

interrupt/1

interrupt(Db::esqlite3_ref()) -> ok

Interrupt all active queries.

last_insert_rowid/1

last_insert_rowid(Connection::esqlite3_ref()) -> rowid()

Get the last insert rowid.

changes/1

changes(Connection::esqlite3_ref()) -> integer()

Get number of changes insert, delete of the most recent completed INSERT, DELETE or UPDATE statement.

get_autocommit/1

get_autocommit(Connection::esqlite3_ref()) -> true | false

Get autocommit

memory_stats/1

memory_stats(HighwaterResetFlag) -> Stats

Get memory statistics

status/2

status(Op, HighwaterResetFlag) -> Stats

Get sqlite status information.

MEMORY_USED 0 PAGECACHE_USED 1 PAGECACHE_OVERFLOW 2 MALLOC_SIZE 5 PARSER_STACK 6 PAGECACHE_SIZE 7 MALLOC_COUNT 8


Generated by EDoc