sqlixx is a C++23 module library that wraps the SQLite database library.
Implements: module sqlixx with connections, statements, binders, and readers.
Status: Experimental
sqlixx is released under the MIT License
import std;
import sqlixx;
int main() {
if (auto conn = sqlixx::open_connection("file:data.db?mode=ro&cache=private", sqlixx::open::uri)) {
if (auto prep = sqlixx::prepare_statement(*conn, "SELECT u.id, u.name FROM users AS u WHERE u.status = ?;")) {
if (auto bind_res = sqlixx::bind_parameters(prep->stmt, "active")) {
int id;
std::string_view name;
for (auto row : sqlixx::execute(prep->stmt)) {
if (sqlixx::read_tuple(row, std::tie(id, name))) {
std::println("id = {}, name = {}", id, name);
}
}
}
}
}
return 0;
}