CMake install tree
Install exports include the vsqlite::vsqlitepp target and package
config files for find_package(vsqlitepp CONFIG REQUIRED).
The following index links to per-class hdoc-style pages. Each page documents every
constructor, method, constant, and public data member that appears in the corresponding
header under include/sqlite/.
Because these files are checked into this repository, new classes automatically pick up a page the next time you regenerate the site.
The project is tested as a library dependency, not only as a top-level checkout. CI validates installed CMake config usage, FetchContent, CPM.cmake, Conan, and the vcpkg overlay port.
Install exports include the vsqlite::vsqlitepp target and package
config files for find_package(vsqlitepp CONFIG REQUIRED).
Subproject use keeps examples, tests, and install rules disabled by default while preserving the same link target.
Use conanfile.py for Conan 2 packages or
packaging/vcpkg as a vcpkg overlay port.
Release tags publish Debian, RPM, and Arch Linux package artifacts alongside source archives.
#include <sqlite/connection.hpp>
#include <sqlite/execute.hpp>
#include <sqlite/query.hpp>
#include <iostream>
sqlite::connection db("notes.db");
sqlite::execute(db, "CREATE TABLE IF NOT EXISTS notes(id INTEGER PRIMARY KEY, text TEXT);", true);
sqlite::execute insert(db, "INSERT INTO notes(text) VALUES(?);");
insert % "Hello";
insert();
sqlite::query q(db, "SELECT id, text FROM notes;");
for(auto & row : q.each()) {
std::cout << '[' << row.get(0) << "] "
<< row.get(1) << '\n';
}
Demonstrates the connection, command, execute, query, and result pages above.
auto factory = sqlite::connection_pool::make_factory("jobs.db");
sqlite::connection_pool pool(4, factory);
auto worker = [&] {
auto lease = pool.acquire();
sqlite::execute(*lease, "INSERT INTO jobs(status) VALUES('done');");
};
std::thread t1(worker), t2(worker);
t1.join(); t2.join();
Relies on threading (configure before creating pools) and connection_pool.
sqlite::json::register_contains_function(db);
sqlite::create_function(db, "double_text",
[](std::string_view s) { return std::string(s) + s; },
{.deterministic = true});
auto where = sqlite::json::contains_expression("payload", sqlite::json::path().key("tags"), "?");
std::string sql = "SELECT id FROM docs WHERE " + where + " AND double_text(title) = ?;";
Pulls together json_fts and function.