Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Prolog bindings for SQLite3 |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.2 |
SHA1 sum: | 8be0cc945cf9cb4bef7c82f694e3d0e1f3d7ede1 |
Author: | Boris Vassilev <boris.vassilev@gmail.com> |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.2 | 8be0cc945cf9cb4bef7c82f694e3d0e1f3d7ede1 | 3 | https://github.com/borisvassilev/swiplite/archive/0.2.zip |
0.1.1 | b151e55053849d23a1eb2cb6ac28fca155f0076c | 3 | https://github.com/borisvassilev/swiplite/archive/0.1.1.zip |
0.1 | 01eee77379899032f179f740c7548651a1b93408 | 3 | https://github.com/borisvassilev/swiplite/archive/0.1.zip |
The purpose of swiplite is to enable using sqlite3 databases comfortably from SWI-Prolog, without sacrificing efficiency.
The prolog/sqlite.pl provides low-level access to the connection and statement objects.
This has been developed and tested on Linux and Mac OS.
You might already have a decently recent version of SQLite installed; you can also install it using the package manager for your OS.
Finally, since this package contains C code, you need CMake and a C compiler.
The pack has been already published. To get the latest release:
$ swipl pack install swiplite
... or from the top level:
?- pack_install(swiplite).
The code is available in the public GitHub repository https://github.com/borisvassilev/swiplite. To install from the source, clone the repo and install from the pack directory:
$ git clone https://github.com/borisvassilev/swiplite.git $ cd swiplite $ swipl pack install .
Alternatively, create an archive and install it locally:
$ git archive --output=swiplite-<version>.tgz <tree-ish> $ swipl pack install swiplite-<version>.tgz
You can use this method specifically if you want to build the
package using the SQLite amalgamation, currently found on its
own branch, sqlite3-amalgamation
:
$ git archive --output=swiplite-<version>.tgz sqlite3-amalgamation
This last method uses c/sqlite3.c
and c/sqlite3.h
.
There are many alternatives to using the swiplite
pack.
Here is a list of questions I have asked myself before
I started working on it (and repeatedly ever since), along
with attempts at answers.
There is no good reason to use SQL; other than, it is the standard interface to relational databases.
... especially since you are using Prolog already?
Relational databases come with features that are not available out of the box on SWI-Prolog:
SQLite provides a full-featured relational database almost for free, in terms of setup and resources needed.
SWI-Prolog provides a full-features ODBC interface). However, specifically in the case of SQLite, it requires a clumsy setup with extra dependencies and no obvious benefit.
proSQLite is a mature SWI-Prolog interface to SQLite also available as a pack. Unfortunately, I was not able to figure out how to use it to create prepared statements with SQL parameters and bind values to them.
It is very likely that prepared statements are not that important. On the other hand, there is the cautionary tale of Little Bobby Tables.
Pack contains 8 files holding a total of 92.1K bytes.