Skip to content

usagi/libWRP-SQLite3

Repository files navigation

libWRP-SQLite3

C++ SQLite3 wrapper library

Features

  • simple for use
    • open with ctor
    • database and statement close automatically with dtor by RAII
    • support execute
    • support prepare, bind and reset
      • bind and reset are chainable :)
    • support low-level controls; eg. step, data_element, data_row
  • compile-time optimization friendly
    • but, not support indeterminately in compile-time
  • header only
    • :)
  • C++11 standard conformable and seal C API
    • rewrite to enum class from CPP #defines
    • std::tuple for use to data row
    • C API was sealed into the namespace WonderRabbitProject::SQLite3::C

Library

The library is in the "./include" directory.

Install

to system: install to /usr/local

sudo ./install.sh

to the other:

PREFIX=~/opt ./install.sh

Usage and Sample

#include <WonderRabbitProject/SQLite3.hpp>

using WonderRabbitProject::SQLite3::sqlite3_t;

sqlite3_t database;
database.execute("create table t(a,b,c)");
database.execute("insert into t values(123, 4.5e+6, 'Hello')");
database.execute("insert into t values(987, 6.5e-4, 'World')");
auto statement = database.prepare("select * from t");
auto data = statement.data<int32_t, double, std::string>();
for ( const auto & row : data )
  std::cout << std::get<0>(row) << "\n"
            << std::get<1>(row) << "\n"
            << std::get<2>(row) << endl
            ;

And more examples available in:

  1. example_01 // basic example
  2. example_02 // blob example
  3. example_03 // execute_data example

Requirement

Optional

API Reference documentations

License

Author

(C)2013 Usagi Ito[email protected] / Wonder Rabbit Project.

About

C++ SQLite3 wrapper library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published