mcpp index

compat.sqlite3

#include

SQLite — self-contained SQL database engine (C amalgamation)

#include <sqlite3.h>
mcpp add compat.sqlite3@3.45.3

Usage

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

// Behavioral test for compat.sqlite3 (SQLite 3.45.3, C API): assert the
// resolved library version, then open an in-memory database, create a table,
// insert a row, and read it back through both sqlite3_exec and a prepared
// statement.
#include <sqlite3.h>
#include <cassert>
#include <cstring>

int main() {
    // The index pins 3.45.3; prove the resolved package is that version.
    assert(std::strcmp(sqlite3_libversion(), "3.45.3") == 0);

    sqlite3* db = nullptr;
    assert(sqlite3_open(":memory:", &db) == SQLITE_OK);
    assert(db != nullptr);

    // DDL + DML through the convenience API.
    char* errmsg = nullptr;
    int rc = sqlite3_exec(db,
        "CREATE TABLE t(id INTEGER PRIMARY KEY, name TEXT NOT NULL);"
        "INSERT INTO t(name) VALUES ('mcpp');",
        nullptr, nullptr, &errmsg);
// …

tests/examples/sqlite3/tests/sqlite3_test.cpp · project tests/examples/sqlite3

Build

targets
sqlite3 (lib)
language
c++23
C standard
c11
import std
no
include dirs
*

Sources (1)

  • */sqlite3.c

Versions

VersionPlatforms Mirrorssha256
3.45.3 latest LinuxWindowsmacOS source ea170e73e447…