Did you know ... | Search Documentation: |
Pack swiplite -- prolog/sqlite.pl |
This module provides partial access to the C-language interface of SQLite.
It exposes the database connection object sqlite3
and the
prepared statement object sqlite3_stmt
, along with some of the
essential functions using these objects. Please refer to the
SQLite documentation
and the implementation in c/swiplite.c
when using this library.
To make it easier to find the relevant docs, I have tried to
consistently provide links.
Most of the predicates in this module are as close as possible in
naming and semantics to the corresponding functions in the C
interface. One exception is sqlite_bind/2, which converts values
from Prolog terms to corresponding
SQLite column datatype.
Similarly, sqlite_eval/1, sqlite_eval/2, and sqlite_eval/4 wrap
the necessary calls to sqlite3_step()
and convert the results of
SELECT
queries to Prolog terms.
The database connection and prepared statement objects are
represented in SWI-Prolog as
blobs.
They are garbage collected, but
finalizing a statement
or closing a database connection
(and, alternatively, not doing it) have reprecussions, especially for
long-running programs. The code in this library uses exclusively the
*_v2
versions of the SQLite C interface. In particular:
The sqlite3_close_v2()
interface is intended for use with host languages that are garbage collected, and where the order in which destructors are called is arbitrary.
The following predicates are exported, but not or incorrectly documented.