mcpp index

compat.sqlitecpp

#include

SQLiteCpp: a smart and easy to use C++ SQLite3 wrapper

#include <SQLiteCpp/SQLiteCpp.h>
mcpp add compat.sqlitecpp@3.3.3

Usage

From this repository's own test project — built and run by CI, not written for the website.

// Behavioral test: a real database session through the RAII wrapper.
//
// The load-bearing question for this package is whether the dependency edge on
// compat.sqlite3 actually replaces upstream's git submodule — and that is a LINK
// question, so every assertion below is chosen to reach sqlite3 symbols: the
// version string, prepared statements with bound parameters, a transaction that
// rolls back, and the exception path (which carries an sqlite3 error code).
#include <SQLiteCpp/SQLiteCpp.h>

#include <cassert>
#include <string>

int main() {
    // The wrapper reports the SQLite it was linked against, which is the
    // cheapest proof that the dependency edge resolved to a real library.
    const std::string version = SQLite::getLibVersion();
    assert(!version.empty() && version[0] == '3');

    SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);

    db.exec("CREATE TABLE note (id INTEGER PRIMARY KEY, title TEXT NOT NULL, size INTEGER)");
    assert(db.tableExists("note"));
// …

tests/examples/sqlitecpp/tests/database.cpp · project tests/examples/sqlitecpp

Build

targets
SQLiteCpp (lib)
language
c++23
import std
no
include dirs
*/include

Sources (1)

  • */src/*.cpp

Versions

VersionPlatforms Mirrorssha256
3.3.3 latest LinuxWindowsmacOS GLOBAL CN 33bd4372d83b…