C++ binding for the SQLite library https://code.ireas.org/sqlitepp/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Robin Krahl 049a90ed8a Add clang-tidy tests to target checkstyle 1 year ago
include/sqlitepp Use deletion instead of unimplemented constructors 1 year ago
src Use nullptr instead of NULL 1 year ago
.gitignore Update .gitignore 2 years ago
Doxyfile Move from CMake to a plain Makefile 2 years ago
LICENSE Refactoring and update. 4 years ago
Makefile Add clang-tidy tests to target checkstyle 1 year ago
README.md Update README.md 2 years ago
config.mk Add version information to the Makefile and to sqlitepp.h 2 years ago



C++ binding for the SQLite library


  • required dependencies
    • libsqlite3
  • optional dependencies
    • libgtest (for tests)
    • Doxygen (for the documentation)
    • Python (for linting)



#include <iostream>
#include <memory>
#include <sqlitepp/sqlitepp.h>

int main(int argc, char** argv) {
  sqlitepp::Database database("/path/to/database.sqlite");
  database.execute("CREATE TABLE test (id, value);");
  std::shared_ptr<sqlitepp::Statement> statement = database.prepare(
      "INSERT INTO test (id, value) VALUES (:id, :value);");
  statement->bind(":id", 1);
  statement->bind(":value", "test value");
  statement = database.prepare("SELECT id, value FROM test;");
  ResultSet resultSet = statement->execute();
  while (resultSet.canRead()) {
    std::cout << "ID: " << resultSet.readInt(0) << "\t value: "
        << resultSet.readString(1) << std::endl;

Compile and run with:

$ g++ --std=c++11 -o test -lsqlitepp -lsqlite3 test.cpp
$ ./test
ID: 1  value: test value

For more information, see the API documentation.