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".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_flag() | integer()
open_flags()
is Flag1 bor Flag2 bor ...
where
FlagN
is one of the open_flag()
values. See C function documentation for
details.
abstract datatype: sqlite3()
An opaque handle that represents a database connection object.
abstract datatype: sqlite3_backup()
A opaque handle to use with Backup API.
abstract datatype: sqlite3_blob()
A opaque handle to use with Blobs API.
sqlite3_error_code() = integer()
sqlite3_error_code
is an integer which corresponds to one of the
constants specified at Result and
Error Codes page.
abstract datatype: sqlite3_snapshot()
A opaque handle to use with Snapshot API.
abstract datatype: sqlite3_stmt()
A opaque handle that represents a prepared statement.
sqlite3_str() = iodata()
sqlite3_str()
is iodata()
which contains a
UTF-8 encoded string.
sqlite3_backup_finish/1 | Release resources associated with the backup. |
sqlite3_backup_init/4 | Initialise Backup object. |
sqlite3_backup_pagecount/1 | Get the number of pages to be copied for the database. |
sqlite3_backup_remaining/1 | Get the remaining number of pages to copy. |
sqlite3_backup_step/2 | Copy the specified number of pages or all pages if
NumPages is set to -1. |
sqlite3_bind/2 | Bind parameters to a compiled SQL statement. |
sqlite3_blob_bytes/1 | Size of the BLOB. |
sqlite3_blob_close/1 | Close a BLOB handle. |
sqlite3_blob_open/6 | Open a BLOB for incremental I/O. |
sqlite3_blob_read/3 | Read data from a BLOB incrementally. |
sqlite3_blob_reopen/2 | Move a BLOB handle to a new row. |
sqlite3_blob_write/3 | Write data into a BLOB incrementally. |
sqlite3_busy_timeout/2 | Set a busy timeout. |
sqlite3_changes/1 | Count the number of modified rows by the last statement. |
sqlite3_clear_bindings/1 | Reset all bindings on a prepared statement. |
sqlite3_close_v2/1 | Close a database connection. |
sqlite3_compileoption_get/1 | Get a compile option string number N . |
sqlite3_compileoption_used/1 | Ask if a specified compile option was set. |
sqlite3_complete/1 | Determine if an SQL statement is complete. |
sqlite3_data_count/1 | Number of columns in a result set. |
sqlite3_db_cacheflush/1 | Flush caches to disk mid-transaction. |
sqlite3_db_config/3 | Configure a database connection. |
sqlite3_db_filename/2 | Return the filename for a database connection. |
sqlite3_db_readonly/2 | Test if the DB is opened in read-only mode. |
sqlite3_db_release_memory/1 | Free memory used by a database connection. |
sqlite3_db_status/3 | Get database connection stats. |
sqlite3_deserialize/3 | Replace a DB schema with the contents of the serialized database. |
sqlite3_errcode/1 | Get the latest error code associated with the connection. |
sqlite3_errmsg/1 | Get the human-readable error message associated with the connection. |
sqlite3_errstr/1 | Convert error code to a human-readable message. |
sqlite3_expanded_sql/1 | Return SQL code associated with the compiled statement with the parameter list expanded. |
sqlite3_extended_errcode/1 | Get the latest extended error code associated with the connection. |
sqlite3_extended_result_codes/2 | Enable or disable extended result codes. |
sqlite3_finalize/1 | Free resources allocated for a prepared statement. |
sqlite3_get_autocommit/1 | Test for auto-commit mode. |
sqlite3_interrupt/1 | Interrupt a long-running query. |
sqlite3_last_insert_rowid/1 | Get the last insert rowid value. |
sqlite3_libversion/0 | Library version. |
sqlite3_libversion_number/0 | Library version as number. |
sqlite3_limit/3 | Change per-connection run-time limits. |
sqlite3_load_extension/3 | Load an extension. |
sqlite3_normalized_sql/1 | Return normalised SQL code associated with the compiled statement, whatever it means. |
sqlite3_open_v2/3 | Open a new database connection. |
sqlite3_prepare_v2/2 | Compile an SQL statement. |
sqlite3_reset/1 | Reset a prepared statement object. |
sqlite3_serialize/2 | Serialise a database into a binary. |
sqlite3_set_last_insert_rowid/2 | |
sqlite3_snapshot_cmp/2 | Compare which snapshot coresspond to an earlier database state. |
sqlite3_snapshot_free/1 | Destroy a snapshot. |
sqlite3_snapshot_get/2 | Record a database snapshot. |
sqlite3_snapshot_open/3 | Start a read transaction on an historical snapshot. |
sqlite3_snapshot_recover/2 | Recover snapshots from a wal file. |
sqlite3_sourceid/0 | Timestamp and hash of the source code used to build the sqlite3 library. |
sqlite3_sql/1 | Return SQL code used for the compiled statement. |
sqlite3_step/1 | Evaluate a compiled SQL statement. |
sqlite3_stmt_busy/1 | Determine if a prepared statement has been reset. |
sqlite3_stmt_isexplain/1 | Query the EXPLAIN setting for a prepared statement. |
sqlite3_stmt_readonly/1 | Determine if an sql statement writes the database. |
sqlite3_stmt_status/3 | Prepared statement status. |
sqlite3_total_changes/1 | Count the total number of modified rows since the connection was opened. |
sqlite3_txn_state/2 | Determine the transaction state of a database. |
sqlite3_wal_autocheckpoint/2 | Configure an auto-checkpoint. |
sqlite3_wal_checkpoint_v2/3 | Checkpoint a database. |
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(DstConn, DstDbName, SrcConn, SrcDbName) -> Result
Initialise Backup object.
sqlite3_backup_pagecount(Backup) -> Result
Get the number of pages to be copied for the database.
sqlite3_backup_remaining(Backup) -> Result
Get the remaining number of pages to copy.
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(Stmt::sqlite3_stmt(), Terms::[Val]) -> Result
Bind parameters to a compiled SQL statement.
sqlite3_blob_bytes(Blob::sqlite3_blob()) -> integer()
Size of the BLOB.
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(Db::sqlite3(), DbName, TabName, ColumnName, RowId, Flags) -> Result
Open a BLOB for incremental I/O.
sqlite3_blob_read(Blob::sqlite3_blob(), N, Offset) -> Result
Read data from a BLOB incrementally.
sqlite3_blob_reopen(Blob::sqlite3_blob(), Rowid) -> sqlite3_error_code()
Move a BLOB handle to a new row.
sqlite3_blob_write(Blob, Data, Offset) -> Result
Write data into a BLOB incrementally.
sqlite3_busy_timeout(Db::sqlite3(), Duration::integer()) -> sqlite3_error_code()
Set a busy timeout.
sqlite3_changes(Db::sqlite3()) -> integer()
Count the number of modified rows by the last statement.
sqlite3_clear_bindings(Stmt::sqlite3_stmt()) -> sqlite3_error_code()
Reset all bindings on a prepared statement.
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(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(OptName) -> integer()
Ask if a specified compile option was set.
sqlite3_complete(Sql::sqlite3_str()) -> integer()
Determine if an SQL statement is complete.
sqlite3_data_count(Stmt::sqlite3_stmt()) -> integer()
Number of columns in a result set.
sqlite3_db_cacheflush(Db::sqlite3()) -> sqlite3_error_code()
Flush caches to disk mid-transaction.
sqlite3_db_config(Db::sqlite3(), Opt, Val) -> Result
Configure a database connection.
sqlite3_db_filename(Db::sqlite3(), DbName) -> DbFileName
Return the filename for a database connection.
sqlite3_db_readonly(Db::sqlite3(), DbName) -> Result
Test if the DB is opened in read-only mode.
sqlite3_db_release_memory(Db::sqlite3()) -> sqlite3_error_code()
Free memory used by a database connection.
sqlite3_db_status(Db::sqlite3(), StatusOpt, ResetFlag) -> Result
Get database connection stats.
sqlite3_deserialize(Db::sqlite3(), DbName, Serialization) -> Result
Replace a DB schema with the contents of the serialized database.
sqlite3_errcode(Db::sqlite3()) -> sqlite3_error_code()
Get the latest error code associated with the connection.
sqlite3_errmsg(Db::sqlite3()) -> binary()
Get the human-readable error message associated with the connection.
sqlite3_errstr(ErrorCode::sqlite3_error_code()) -> binary()
Convert error code to a human-readable message.
sqlite3_expanded_sql(Stmt::sqlite3_stmt()) -> binary()
Return SQL code associated with the compiled statement with the parameter list expanded.
sqlite3_extended_errcode(Db::sqlite3()) -> sqlite3_error_code()
Get the latest extended error code associated with the connection.
sqlite3_extended_result_codes(Db::sqlite3(), OnOff) -> sqlite3_error_code()
Enable or disable extended result codes.
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(Db::sqlite3()) -> integer()
Test for auto-commit mode.
sqlite3_interrupt(Db::sqlite3()) -> ok
Interrupt a long-running query.
sqlite3_last_insert_rowid(Db::sqlite3()) -> integer()
Get the last insert rowid value.
sqlite3_libversion() -> binary()
Library version.
sqlite3_libversion_number() -> integer()
Library version as number.
sqlite3_limit(Db::sqlite3(), LimitId, NewVal) -> integer()
Change per-connection run-time limits.
sqlite3_load_extension(Db::sqlite3(), ExtFile, EntryPoint) -> Result
Load an extension.
sqlite3_normalized_sql(Stmt::sqlite3_stmt()) -> binary()
Return normalised SQL code associated with the compiled statement, whatever it means.
sqlite3_open_v2(FileName, Flags, Vfs) -> Result
Open a new database connection.
sqlite3_prepare_v2(Db::sqlite3(), Sql) -> Result
Compile an SQL statement.
sqlite3_reset(Stmt::sqlite3_stmt()) -> sqlite3_error_code()
Reset a prepared statement object.
sqlite3_serialize(Db::sqlite3(), DbName) -> Result
Serialise a database into a binary.
sqlite3_set_last_insert_rowid(Db::sqlite3(), NewRowid::integer()) -> ok
sqlite3_snapshot_cmp(Snapshot1, Snapshot2) -> Result
Compare which snapshot coresspond to an earlier database state.
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(Db::sqlite3(), DbName) -> Result
Record a database snapshot.
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(Db::sqlite3(), DbName) -> Result
Recover snapshots from a wal file.
sqlite3_sourceid() -> binary()
Timestamp and hash of the source code used to build the sqlite3 library.
sqlite3_sql(Stmt::sqlite3_stmt()) -> binary()
Return SQL code used for the compiled statement.
sqlite3_step(Stmt::sqlite3_stmt()) -> Result
Evaluate a compiled SQL statement.
sqlite3_stmt_busy(Stmt::sqlite3_stmt()) -> integer()
Determine if a prepared statement has been reset.
sqlite3_stmt_isexplain(Stmt::sqlite3_stmt()) -> integer()
Query the EXPLAIN setting for a prepared statement.
sqlite3_stmt_readonly(Stmt::sqlite3_stmt()) -> integer()
Determine if an sql statement writes the database.
sqlite3_stmt_status(Stmt::sqlite3_stmt(), StmtStatus, ResetFlag) -> Result
Prepared statement status.
sqlite3_total_changes(Db::sqlite3()) -> integer()
Count the total number of modified rows since the connection was opened.
sqlite3_txn_state(Db::sqlite3(), DbName) -> Result
Determine the transaction state of a database.
sqlite3_wal_autocheckpoint(Db::sqlite3(), NFrames) -> sqlite3_error_code()
Configure an auto-checkpoint.
sqlite3_wal_checkpoint_v2(Db::sqlite3(), DbName, Mode) -> Result
Checkpoint a database.
Generated by EDoc