AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
anch::sql::SQLite3Connection Class Reference

SQLite3 connection. More...

#include <sqlite3Connection.hpp>

+ Inheritance diagram for anch::sql::SQLite3Connection:
+ Collaboration diagram for anch::sql::SQLite3Connection:

Public Member Functions

 SQLite3Connection (const std::string &database)
 
 SQLite3Connection (const SqlConnectionConfiguration &config)
 
 SQLite3Connection (const SQLite3Connection &)=delete
 
virtual ~SQLite3Connection () noexcept
 
- Public Member Functions inherited from anch::sql::Connection
 Connection ()
 
 Connection (const Connection &)=delete
 
virtual ~Connection () noexcept
 
void startTransaction ()
 
void begin ()
 
void commit ()
 
void rollback ()
 
void release () noexcept
 
PreparedStatementprepareStatement (const std::string &query)
 
ResultSetquery (const std::string &query)
 
void queryMapRow (const std::string &sqlQuery, std::function< void(ResultSet &)> rowMapper)
 
void queryExtract (const std::string &sqlQuery, std::function< void(ResultSet &)> resExtractor)
 
template<typename T, typename... Q>
ResultSetquery (const std::string &query, const T &value, const Q &... values)
 
template<typename T, typename... Q>
void queryMapRow (const std::string &query, std::function< void(ResultSet &)> rowMapper, const T &value, const Q &... values)
 
template<typename T, typename... Q>
void queryExtract (const std::string &query, std::function< void(ResultSet &)> resExtractor, const T &value, const Q &... values)
 
uint64_t update (const std::string &query)
 
template<typename T, typename... Q>
uint64_t update (const std::string &query, const T &value, const Q &... values)
 
template<typename T, typename Iterable>
uint64_t batchUpdate (const std::string &query, std::function< void(PreparedStatement &, const T &)> mapper, const Iterable &values)
 
bool isValid () const noexcept
 

Protected Member Functions

virtual ResultSetexecuteQuery (const std::string &query) override
 
virtual uint64_t executeUpdate (const std::string &query) override
 
virtual void sendCommit () override
 
virtual void sendRollback () override
 
virtual void sendStartTransaction () override
 
virtual PreparedStatementmakePrepared (const std::string &query) override
 
- Protected Member Functions inherited from anch::sql::Connection
void setValid (bool valid) noexcept
 

Additional Inherited Members

- Protected Attributes inherited from anch::sql::Connection
bool _valid
 
bool _transaction
 
std::map< std::string, PreparedStatement * > _stmts
 
bool _errors
 

Detailed Description

SQLite3 connection.

SQL connection implementation through SQLite3 native library

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ SQLite3Connection() [1/3]

anch::sql::SQLite3Connection::SQLite3Connection ( const std::string & database)

SQLite3Connection constructor

Parameters
databasethe database path
Exceptions
SqlExceptionfail to create connection

◆ SQLite3Connection() [2/3]

anch::sql::SQLite3Connection::SQLite3Connection ( const SqlConnectionConfiguration & config)

SQLite3Connection constructor

Parameters
configthe SQLite3 configuration
Exceptions
SqlExceptionfail to create connection

◆ SQLite3Connection() [3/3]

anch::sql::SQLite3Connection::SQLite3Connection ( const SQLite3Connection & )
delete

Prohibit SQLite3Connection copy constructor

+ Here is the call graph for this function:

◆ ~SQLite3Connection()

virtual anch::sql::SQLite3Connection::~SQLite3Connection ( )
virtualnoexcept

SQLite3Connection destructor

Member Function Documentation

◆ executeQuery()

virtual ResultSet * anch::sql::SQLite3Connection::executeQuery ( const std::string & query)
overrideprotectedvirtual

Execute SQL select query

Parameters
querythe SQL query to execute
Returns
the result set
Exceptions
SqlExceptionany error

Implements anch::sql::Connection.

+ Here is the call graph for this function:

◆ executeUpdate()

virtual uint64_t anch::sql::SQLite3Connection::executeUpdate ( const std::string & query)
overrideprotectedvirtual

Execute SQL update query

Parameters
querythe SQL query to execute
Returns
the number of updated rows
Exceptions
SqlExceptionany error

Implements anch::sql::Connection.

+ Here is the call graph for this function:

◆ makePrepared()

virtual PreparedStatement * anch::sql::SQLite3Connection::makePrepared ( const std::string & query)
overrideprotectedvirtual

Send SQL query to prepare SQL statement

Parameters
querythe SQL query
Returns
the prepared statement
Exceptions
SqlExceptionany error

Implements anch::sql::Connection.

+ Here is the call graph for this function:

◆ sendCommit()

virtual void anch::sql::SQLite3Connection::sendCommit ( )
overrideprotectedvirtual

Send commit to database server

Exceptions
SqlExceptionfail to commit transaction

Implements anch::sql::Connection.

+ Here is the call graph for this function:

◆ sendRollback()

virtual void anch::sql::SQLite3Connection::sendRollback ( )
overrideprotectedvirtual

Send rollback to database server

Exceptions
SqlExceptionfail to rollback transaction

Implements anch::sql::Connection.

+ Here is the call graph for this function:

◆ sendStartTransaction()

virtual void anch::sql::SQLite3Connection::sendStartTransaction ( )
overrideprotectedvirtual

Send start transaction to database server

Exceptions
SqlExceptionany error

Implements anch::sql::Connection.

+ Here is the call graph for this function:

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