SQLitePlus  v1.04
A modern C++ header only SQLite3 wrapper.
Public Member Functions | Public Attributes | List of all members
SQLITE3 Class Reference

#include <SQLITE3.hpp>

Public Member Functions

 SQLITE3 (const std::string &db_name="")
 
 SQLITE3 (const SQLITE3 &rhs)
 
SQLITE3operator= (const SQLITE3 &rhs)
 
 ~SQLITE3 ()
 
int open (std::string &db_name)
 
int commit ()
 
int execute (SQLITE3_QUERY &query)
 
int execute (std::string &query)
 
int execute (const char *query)
 
std::shared_ptr< SQLITE_ROW_VECTOR > copy_column_names () const
 
int get_result_col_count () const
 
int get_result_row_count () const
 
std::shared_ptr< std::vector< SQLITE_ROW_VECTOR > > copy_result () const
 
const std::vector< SQLITE_ROW_VECTOR > * get_result () const
 
void print_result () const
 
const sqlite3 * get_db () const
 
void perror ()
 
int add_function (const std::string &name, int argc, void(*lambda)(sqlite3_context *, int, sqlite3_value **))
 

Public Attributes

char error_no {}
 

Detailed Description

Wrapper Library for sqlite3

Constructor & Destructor Documentation

◆ SQLITE3() [1/2]

SQLITE3::SQLITE3 ( const std::string &  db_name = "")
inlineexplicit

Constructor

Parameters
db_namename of database to open

◆ SQLITE3() [2/2]

SQLITE3::SQLITE3 ( const SQLITE3 rhs)
inline

copy construction

◆ ~SQLITE3()

SQLITE3::~SQLITE3 ( )
inline

Destructor

Member Function Documentation

◆ add_function()

int SQLITE3::add_function ( const std::string &  name,
int  argc,
void(*)(sqlite3_context *, int, sqlite3_value **)  lambda 
)
inline

Add simple user defined function to database

Parameters
namename of function
argcnumber of argument a function take
lambdafunction implementation @lambda_arg void (sqlite3_context* context, int argc, sqlite3_value** value)
Returns
0 upon success, 1 upon failure

◆ commit()

int SQLITE3::commit ( )
inline

Commit all change to database, then start a new transaction

Returns
0 upon success, 1 upon failure

◆ copy_column_names()

std::shared_ptr<SQLITE_ROW_VECTOR> SQLITE3::copy_column_names ( ) const
inline

Return the a copy of the column names for the result of the last query

Returns
shared pointer pointing to a copy of the column name

◆ copy_result()

std::shared_ptr<std::vector<SQLITE_ROW_VECTOR> > SQLITE3::copy_result ( ) const
inline

Return the a copy of the result of the last query

Returns
shared pointer pointing to a copy of the result

◆ execute() [1/3]

int SQLITE3::execute ( const char *  query)
inline

Execute query

Parameters
query
Returns
0 upon success, 1 upon failure

◆ execute() [2/3]

int SQLITE3::execute ( SQLITE3_QUERY query)
inline

Execute query

Parameters
query
Returns
0 upon success, 1 upon failure

◆ execute() [3/3]

int SQLITE3::execute ( std::string &  query)
inline

Execute query

Parameters
query
Returns
0 upon success, 1 upon failure

◆ get_db()

const sqlite3* SQLITE3::get_db ( ) const
inline

Get sqlite3 pointer, allowing user to expand the functions of SQLite

Returns
pointer to db

◆ get_result()

const std::vector<SQLITE_ROW_VECTOR>* SQLITE3::get_result ( ) const
inline
Deprecated:
Deprecated due to possibility of unsafe memory access

Return the result of a query

Returns
pointer to

◆ get_result_col_count()

int SQLITE3::get_result_col_count ( ) const
inline

Get the number of col returned

Returns
number of col

◆ get_result_row_count()

int SQLITE3::get_result_row_count ( ) const
inline

Get the number of row returned

Returns
number of row

◆ open()

int SQLITE3::open ( std::string &  db_name)
inline

Connect to db named db_name

Parameters
db_namename of the database to open
Returns
0 upon success, 1 upon failure

◆ operator=()

SQLITE3& SQLITE3::operator= ( const SQLITE3 rhs)
inline

copy assign

◆ perror()

void SQLITE3::perror ( )
inline

Read the class wide error_no and print parsed error to std::cerr

◆ print_result()

void SQLITE3::print_result ( ) const
inline

Print out result of a query


The documentation for this class was generated from the following file: