(Created by gh-md-toc)
The idea is to minimize boilerplate code when doing the same things using native SQLite API. Only recurring usages are wrapped into helper classes or plain functions. Mixed uses of this module and the native API are expected. Always prefer bux::C_SQLite
, bux::C_SQLiteStmt
over sqlite3*
, sqlite3_stmt*
and you will be fine.
Original Type | Wrapper Class |
---|---|
sqlite3* |
bux::C_SQLite |
sqlite3_stmt* |
bux::C_SQLiteStmt |
- The right colum (class type) of each row above can be cast to the left column (native SQLite pointer type) implicitly & safely.
bux::C_SQLite
can only be constructed by a valid SQLite databse file name.bux::C_SQLiteStmt
is contructed by passing abux::C_SQLite
instance and a SQL statement. And it is the recommended way to bind SQL arguments by calling nativesqlite3_bind_\w+()
functions before its ownexecute()
method.
in ArchLinux
-
Make sure you have installed
yay
or any other pacman wrapper. -
yay -S bux-sqlite
to install.bux
is also installed with it. -
yay -Ql bux-sqlite
to see the installed files:bux-sqlite /usr/ bux-sqlite /usr/include/ bux-sqlite /usr/include/bux/ bux-sqlite /usr/include/bux/oo_sqlite.h bux-sqlite /usr/lib/ bux-sqlite /usr/lib/libbux-sqlite.a bux-sqlite /usr/share/ bux-sqlite /usr/share/licenses/ bux-sqlite /usr/share/licenses/bux-sqlite/ bux-sqlite /usr/share/licenses/bux-sqlite/LICENSE
-
Include the sole header file by prefixing the header name with
bux/
:#include <bux/oo_sqlite.h>
p.s. Compiler is expected to search
/usr/include
by default. -
Make sure
bux
is also installed. -
If directly using
gcc
orclang
is intended, the required compiler flags are-lbux-sqlite -lbux
from github in any of Linux distros
-
Make sure you have installed
cmake
make
gcc
git
sqlite
, or the likes. Known package names in different distros/package-managers:Distro/PkgMngr Package Name ArchLinux/yay sqlite
Fedora/dnf sqlite-devel
-
git clone https://github.com/buck-yeh/bux-sqlite.git cd bux-sqlite cmake -D FETCH_DEPENDEES=1 -D DEPENDEE_ROOT=_deps . make -j
-
Make sure
bux
is also installed or built. -
Include
include/bux/oo_sqlite.h
and link withsrc/libbux-sqlite.a
&whereever-you-install-or-build-it/libbux.a