Module sqlite3_nif

A low-level NIF interface to sqlite3.

Description

A low-level NIF interface to sqlite3.

Most of the exposed functions follow the C API to the letter so the official documentation should be considered as the primary source of information, while the C API introduction should be read as a "Getting Started Guide".

Data Types

open_flag()

open_flag() = '?SQLITE_OPEN_READONLY' | '?SQLITE_OPEN_READWRITE' | '?SQLITE_OPEN_CREATE' | '?SQLITE_OPEN_URI' | '?SQLITE_OPEN_MEMORY' | '?SQLITE_OPEN_FULLMUTEX' | '?SQLITE_OPEN_SHAREDCACHE' | '?SQLITE_OPEN_PRIVATECACHE' | '?SQLITE_OPEN_NOFOLLOW'

open_flags()

open_flags() = open_flag() | integer()

open_flags() is Flag1 bor Flag2 bor ... where FlagN is one of the open_flag() values. See C function documentation for details.

sqlite3()

abstract datatype: sqlite3()

An opaque handle that represents a database connection object.

sqlite3_backup()

abstract datatype: sqlite3_backup()

A opaque handle to use with Backup API.

sqlite3_blob()

abstract datatype: sqlite3_blob()

A opaque handle to use with Blobs API.

sqlite3_error_code()

sqlite3_error_code() = integer()

sqlite3_error_code is an integer which corresponds to one of the constants specified at Result and Error Codes page.

sqlite3_snapshot()

abstract datatype: sqlite3_snapshot()

A opaque handle to use with Snapshot API.

sqlite3_stmt()

abstract datatype: sqlite3_stmt()

A opaque handle that represents a prepared statement.

sqlite3_str()

sqlite3_str() = iodata()

sqlite3_str() is iodata() which contains a UTF-8 encoded string.

Function Index

sqlite3_backup_finish/1Release resources associated with the backup.
sqlite3_backup_init/4Initialise Backup object.
sqlite3_backup_pagecount/1Get the number of pages to be copied for the database.
sqlite3_backup_remaining/1Get the remaining number of pages to copy.
sqlite3_backup_step/2Copy the specified number of pages or all pages if NumPages is set to -1.
sqlite3_bind/2Bind parameters to a compiled SQL statement.
sqlite3_blob_bytes/1Size of the BLOB.
sqlite3_blob_close/1Close a BLOB handle.
sqlite3_blob_open/6Open a BLOB for incremental I/O.
sqlite3_blob_read/3Read data from a BLOB incrementally.
sqlite3_blob_reopen/2Move a BLOB handle to a new row.
sqlite3_blob_write/3Write data into a BLOB incrementally.
sqlite3_busy_timeout/2Set a busy timeout.
sqlite3_changes/1Count the number of modified rows by the last statement.
sqlite3_clear_bindings/1Reset all bindings on a prepared statement.
sqlite3_close_v2/1Close a database connection.
sqlite3_compileoption_get/1Get a compile option string number N.
sqlite3_compileoption_used/1Ask if a specified compile option was set.
sqlite3_complete/1Determine if an SQL statement is complete.
sqlite3_data_count/1Number of columns in a result set.
sqlite3_db_cacheflush/1Flush caches to disk mid-transaction.
sqlite3_db_config/3Configure a database connection.
sqlite3_db_filename/2Return the filename for a database connection.
sqlite3_db_readonly/2Test if the DB is opened in read-only mode.
sqlite3_db_release_memory/1Free memory used by a database connection.
sqlite3_db_status/3Get database connection stats.
sqlite3_deserialize/3Replace a DB schema with the contents of the serialized database.
sqlite3_errcode/1Get the latest error code associated with the connection.
sqlite3_errmsg/1Get the human-readable error message associated with the connection.
sqlite3_errstr/1Convert error code to a human-readable message.
sqlite3_expanded_sql/1Return SQL code associated with the compiled statement with the parameter list expanded.
sqlite3_extended_errcode/1Get the latest extended error code associated with the connection.
sqlite3_extended_result_codes/2Enable or disable extended result codes.
sqlite3_finalize/1Free resources allocated for a prepared statement.
sqlite3_get_autocommit/1Test for auto-commit mode.
sqlite3_interrupt/1Interrupt a long-running query.
sqlite3_last_insert_rowid/1Get the last insert rowid value.
sqlite3_libversion/0Library version.
sqlite3_libversion_number/0Library version as number.
sqlite3_limit/3Change per-connection run-time limits.
sqlite3_load_extension/3Load an extension.
sqlite3_normalized_sql/1Return normalised SQL code associated with the compiled statement, whatever it means.
sqlite3_open_v2/3Open a new database connection.
sqlite3_prepare_v2/2Compile an SQL statement.
sqlite3_reset/1Reset a prepared statement object.
sqlite3_serialize/2Serialise a database into a binary.
sqlite3_set_last_insert_rowid/2
sqlite3_snapshot_cmp/2Compare which snapshot coresspond to an earlier database state.
sqlite3_snapshot_free/1Destroy a snapshot.
sqlite3_snapshot_get/2Record a database snapshot.
sqlite3_snapshot_open/3Start a read transaction on an historical snapshot.
sqlite3_snapshot_recover/2Recover snapshots from a wal file.
sqlite3_sourceid/0Timestamp and hash of the source code used to build the sqlite3 library.
sqlite3_sql/1Return SQL code used for the compiled statement.
sqlite3_step/1Evaluate a compiled SQL statement.
sqlite3_stmt_busy/1Determine if a prepared statement has been reset.
sqlite3_stmt_isexplain/1Query the EXPLAIN setting for a prepared statement.
sqlite3_stmt_readonly/1Determine if an sql statement writes the database.
sqlite3_stmt_status/3Prepared statement status.
sqlite3_total_changes/1Count the total number of modified rows since the connection was opened.
sqlite3_txn_state/2Determine the transaction state of a database.
sqlite3_wal_autocheckpoint/2Configure an auto-checkpoint.
sqlite3_wal_checkpoint_v2/3Checkpoint a database.

Function Details

sqlite3_backup_finish/1

sqlite3_backup_finish(Backup) -> Result

Release resources associated with the backup. Note, there is no need to call the function because the Backup object is reference-counted and will be released automatically.

sqlite3_backup_init/4

sqlite3_backup_init(DstConn, DstDbName, SrcConn, SrcDbName) -> Result

Initialise Backup object.

sqlite3_backup_pagecount/1

sqlite3_backup_pagecount(Backup) -> Result

Get the number of pages to be copied for the database.

sqlite3_backup_remaining/1

sqlite3_backup_remaining(Backup) -> Result

Get the remaining number of pages to copy.

sqlite3_backup_step/2

sqlite3_backup_step(Backup::sqlite3_backup(), NumPages) -> Result

Copy the specified number of pages or all pages if NumPages is set to -1.

sqlite3_bind/2

sqlite3_bind(Stmt::sqlite3_stmt(), Terms::[Val]) -> Result

Bind parameters to a compiled SQL statement.

sqlite3_blob_bytes/1

sqlite3_blob_bytes(Blob::sqlite3_blob()) -> integer()

Size of the BLOB.

sqlite3_blob_close/1

sqlite3_blob_close(Blob::sqlite3_blob()) -> sqlite3_error_code()

Close a BLOB handle. Note, normally, there is no need to call the function since the object is reference-counted and will be released automatically.

sqlite3_blob_open/6

sqlite3_blob_open(Db::sqlite3(), DbName, TabName, ColumnName, RowId, Flags) -> Result

Open a BLOB for incremental I/O.

sqlite3_blob_read/3

sqlite3_blob_read(Blob::sqlite3_blob(), N, Offset) -> Result

Read data from a BLOB incrementally.

sqlite3_blob_reopen/2

sqlite3_blob_reopen(Blob::sqlite3_blob(), Rowid) -> sqlite3_error_code()

Move a BLOB handle to a new row.

sqlite3_blob_write/3

sqlite3_blob_write(Blob, Data, Offset) -> Result

Write data into a BLOB incrementally.

sqlite3_busy_timeout/2

sqlite3_busy_timeout(Db::sqlite3(), Duration::integer()) -> sqlite3_error_code()

Set a busy timeout.

sqlite3_changes/1

sqlite3_changes(Db::sqlite3()) -> integer()

Count the number of modified rows by the last statement.

sqlite3_clear_bindings/1

sqlite3_clear_bindings(Stmt::sqlite3_stmt()) -> sqlite3_error_code()

Reset all bindings on a prepared statement.

sqlite3_close_v2/1

sqlite3_close_v2(Db::sqlite3()) -> sqlite3_error_code()

Close a database connection. Note, it is not mandatory to close an open connection using the function since it is reference counted and will be closed automatically. The only case where it may be required to close it is when some action is expected to be performed by SQLite engine (e.g. WAL file is removed when all connections to a DB file are closed).

sqlite3_compileoption_get/1

sqlite3_compileoption_get(N::integer()) -> binary() | nil

Get a compile option string number N. Can be used to receive the total number of compile opitons.

sqlite3_compileoption_used/1

sqlite3_compileoption_used(OptName) -> integer()

Ask if a specified compile option was set.

sqlite3_complete/1

sqlite3_complete(Sql::sqlite3_str()) -> integer()

Determine if an SQL statement is complete.

sqlite3_data_count/1

sqlite3_data_count(Stmt::sqlite3_stmt()) -> integer()

Number of columns in a result set.

sqlite3_db_cacheflush/1

sqlite3_db_cacheflush(Db::sqlite3()) -> sqlite3_error_code()

Flush caches to disk mid-transaction.

sqlite3_db_config/3

sqlite3_db_config(Db::sqlite3(), Opt, Val) -> Result

Configure a database connection.

sqlite3_db_filename/2

sqlite3_db_filename(Db::sqlite3(), DbName) -> DbFileName

Return the filename for a database connection.

sqlite3_db_readonly/2

sqlite3_db_readonly(Db::sqlite3(), DbName) -> Result

Test if the DB is opened in read-only mode.

sqlite3_db_release_memory/1

sqlite3_db_release_memory(Db::sqlite3()) -> sqlite3_error_code()

Free memory used by a database connection.

sqlite3_db_status/3

sqlite3_db_status(Db::sqlite3(), StatusOpt, ResetFlag) -> Result

Get database connection stats.

sqlite3_deserialize/3

sqlite3_deserialize(Db::sqlite3(), DbName, Serialization) -> Result

Replace a DB schema with the contents of the serialized database.

sqlite3_errcode/1

sqlite3_errcode(Db::sqlite3()) -> sqlite3_error_code()

Get the latest error code associated with the connection.

sqlite3_errmsg/1

sqlite3_errmsg(Db::sqlite3()) -> binary()

Get the human-readable error message associated with the connection.

sqlite3_errstr/1

sqlite3_errstr(ErrorCode::sqlite3_error_code()) -> binary()

Convert error code to a human-readable message.

sqlite3_expanded_sql/1

sqlite3_expanded_sql(Stmt::sqlite3_stmt()) -> binary()

Return SQL code associated with the compiled statement with the parameter list expanded.

sqlite3_extended_errcode/1

sqlite3_extended_errcode(Db::sqlite3()) -> sqlite3_error_code()

Get the latest extended error code associated with the connection.

sqlite3_extended_result_codes/2

sqlite3_extended_result_codes(Db::sqlite3(), OnOff) -> sqlite3_error_code()

Enable or disable extended result codes.

sqlite3_finalize/1

sqlite3_finalize(Stmt::sqlite3_stmt()) -> sqlite3_error_code()

Free resources allocated for a prepared statement. Note, normally there is no need to call the function because the statement is reference-counted and will be de-allocated automatically.

sqlite3_get_autocommit/1

sqlite3_get_autocommit(Db::sqlite3()) -> integer()

Test for auto-commit mode.

sqlite3_interrupt/1

sqlite3_interrupt(Db::sqlite3()) -> ok

Interrupt a long-running query.

sqlite3_last_insert_rowid/1

sqlite3_last_insert_rowid(Db::sqlite3()) -> integer()

Get the last insert rowid value.

sqlite3_libversion/0

sqlite3_libversion() -> binary()

Library version.

sqlite3_libversion_number/0

sqlite3_libversion_number() -> integer()

Library version as number.

sqlite3_limit/3

sqlite3_limit(Db::sqlite3(), LimitId, NewVal) -> integer()

Change per-connection run-time limits.

sqlite3_load_extension/3

sqlite3_load_extension(Db::sqlite3(), ExtFile, EntryPoint) -> Result

Load an extension.

sqlite3_normalized_sql/1

sqlite3_normalized_sql(Stmt::sqlite3_stmt()) -> binary()

Return normalised SQL code associated with the compiled statement, whatever it means.

sqlite3_open_v2/3

sqlite3_open_v2(FileName, Flags, Vfs) -> Result

Open a new database connection.

sqlite3_prepare_v2/2

sqlite3_prepare_v2(Db::sqlite3(), Sql) -> Result

Compile an SQL statement.

sqlite3_reset/1

sqlite3_reset(Stmt::sqlite3_stmt()) -> sqlite3_error_code()

Reset a prepared statement object.

sqlite3_serialize/2

sqlite3_serialize(Db::sqlite3(), DbName) -> Result

Serialise a database into a binary.

sqlite3_set_last_insert_rowid/2

sqlite3_set_last_insert_rowid(Db::sqlite3(), NewRowid::integer()) -> ok

sqlite3_snapshot_cmp/2

sqlite3_snapshot_cmp(Snapshot1, Snapshot2) -> Result

Compare which snapshot coresspond to an earlier database state.

sqlite3_snapshot_free/1

sqlite3_snapshot_free(Snapshot::sqlite3_snapshot()) -> ok

Destroy a snapshot. Note, normally, there is no need to call the function since the snapshot object is reference-counted and destroyed automatically.

sqlite3_snapshot_get/2

sqlite3_snapshot_get(Db::sqlite3(), DbName) -> Result

Record a database snapshot.

sqlite3_snapshot_open/3

sqlite3_snapshot_open(Db::sqlite3(), DbName::sqlite3_str(), Snapshot::sqlite3_snapshot()) -> sqlite3_error_code()

Start a read transaction on an historical snapshot.

sqlite3_snapshot_recover/2

sqlite3_snapshot_recover(Db::sqlite3(), DbName) -> Result

Recover snapshots from a wal file.

sqlite3_sourceid/0

sqlite3_sourceid() -> binary()

Timestamp and hash of the source code used to build the sqlite3 library.

sqlite3_sql/1

sqlite3_sql(Stmt::sqlite3_stmt()) -> binary()

Return SQL code used for the compiled statement.

sqlite3_step/1

sqlite3_step(Stmt::sqlite3_stmt()) -> Result

Evaluate a compiled SQL statement.

sqlite3_stmt_busy/1

sqlite3_stmt_busy(Stmt::sqlite3_stmt()) -> integer()

Determine if a prepared statement has been reset.

sqlite3_stmt_isexplain/1

sqlite3_stmt_isexplain(Stmt::sqlite3_stmt()) -> integer()

Query the EXPLAIN setting for a prepared statement.

sqlite3_stmt_readonly/1

sqlite3_stmt_readonly(Stmt::sqlite3_stmt()) -> integer()

Determine if an sql statement writes the database.

sqlite3_stmt_status/3

sqlite3_stmt_status(Stmt::sqlite3_stmt(), StmtStatus, ResetFlag) -> Result

Prepared statement status.

sqlite3_total_changes/1

sqlite3_total_changes(Db::sqlite3()) -> integer()

Count the total number of modified rows since the connection was opened.

sqlite3_txn_state/2

sqlite3_txn_state(Db::sqlite3(), DbName) -> Result

Determine the transaction state of a database.

sqlite3_wal_autocheckpoint/2

sqlite3_wal_autocheckpoint(Db::sqlite3(), NFrames) -> sqlite3_error_code()

Configure an auto-checkpoint.

sqlite3_wal_checkpoint_v2/3

sqlite3_wal_checkpoint_v2(Db::sqlite3(), DbName, Mode) -> Result

Checkpoint a database.


Generated by EDoc