SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
benchmax::DBAL Class Reference

#include <Database_mysqlconnector.h>

Collaboration diagram for benchmax::DBAL:

Public Types

using Index = std::size_t
 Indec type. More...
 
using Statement = std::unique_ptr< sql::PreparedStatement >
 Statement type. More...
 
using Results = std::unique_ptr< sql::ResultSet >
 Results type. More...
 
typedef mysqlpp::sql_bigint_unsigned Index
 
typedef mysqlpp::Query Statement
 
typedef mysqlpp::StoreQueryResult Results
 

Public Member Functions

bool connect (const std::string &db, const std::string &host, const std::string &user, const std::string &password)
 Connect to the given database. More...
 
Statement prepare (const std::string &query)
 Prepare a statement. More...
 
Results execute (Statement &stmt)
 Execute a statement without arguments. More...
 
Results execute (Statement &stmt, const std::string &a1)
 Execute a statement with a single string. More...
 
Results execute (Statement &stmt, const std::string &a1, std::size_t a2)
 Execute a statement with a string and a number. More...
 
Results execute (Statement &stmt, const std::string &a1, const std::string &a2, const Index &a3)
 Execute a statement with two strings and an index. More...
 
Results execute (Statement &stmt, int a1, std::size_t a2, std::size_t a3, const Index &a4, const Index &a5, const Index &a6)
 Execute a statement with an int, two numbers and three indices. More...
 
template<typename... Args>
Index insert (const std::string &query, const Args &... args)
 Insert some data and return the new index. More...
 
template<typename... Args>
Results select (const std::string &query, const Args &... args)
 Select some data. More...
 
std::size_t size (const Results &res)
 Return the size of the results. More...
 
Index getIndex (const Results &res, const std::string &name)
 Get the index of some name within the results. More...
 
bool connect (const std::string &db, const std::string &host, const std::string &user, const std::string &password)
 
Statement prepare (const std::string &query)
 
template<typename... Args>
void execute (Statement &stmt, const Args &... args)
 
template<typename... Args>
Index insert (const std::string &query, const Args &... args)
 
template<typename... Args>
Results select (const std::string &query, const Args &... args)
 
std::size_t size (const Results &res)
 
Index getIndex (const Results &res, const std::string &name)
 

Private Member Functions

std::string replacePlaceholders (const std::string &s)
 

Private Attributes

std::unique_ptr< sql::Driver > driver
 
std::unique_ptr< sql::Connection > conn
 
mysqlpp::Connection conn
 

Detailed Description

Definition at line 18 of file Database_mysqlconnector.h.

Member Typedef Documentation

◆ Index [1/2]

using benchmax::DBAL::Index = std::size_t

Indec type.

Definition at line 35 of file Database_mysqlconnector.h.

◆ Index [2/2]

typedef mysqlpp::sql_bigint_unsigned benchmax::DBAL::Index

Definition at line 19 of file Database_mysqlpp.h.

◆ Results [1/2]

using benchmax::DBAL::Results = std::unique_ptr<sql::ResultSet>

Results type.

Definition at line 39 of file Database_mysqlconnector.h.

◆ Results [2/2]

typedef mysqlpp::StoreQueryResult benchmax::DBAL::Results

Definition at line 21 of file Database_mysqlpp.h.

◆ Statement [1/2]

using benchmax::DBAL::Statement = std::unique_ptr<sql::PreparedStatement>

Statement type.

Definition at line 37 of file Database_mysqlconnector.h.

◆ Statement [2/2]

typedef mysqlpp::Query benchmax::DBAL::Statement

Definition at line 20 of file Database_mysqlpp.h.

Member Function Documentation

◆ connect() [1/2]

bool benchmax::DBAL::connect ( const std::string &  db,
const std::string &  host,
const std::string &  user,
const std::string &  password 
)
inline

Connect to the given database.

Definition at line 42 of file Database_mysqlconnector.h.

◆ connect() [2/2]

bool benchmax::DBAL::connect ( const std::string &  db,
const std::string &  host,
const std::string &  user,
const std::string &  password 
)
inline

Definition at line 23 of file Database_mysqlpp.h.

◆ execute() [1/6]

Results benchmax::DBAL::execute ( Statement stmt)
inline

Execute a statement without arguments.

Definition at line 57 of file Database_mysqlconnector.h.

Here is the caller graph for this function:

◆ execute() [2/6]

template<typename... Args>
void benchmax::DBAL::execute ( Statement stmt,
const Args &...  args 
)
inline

Definition at line 32 of file Database_mysqlpp.h.

◆ execute() [3/6]

Results benchmax::DBAL::execute ( Statement stmt,
const std::string &  a1 
)
inline

Execute a statement with a single string.

Definition at line 61 of file Database_mysqlconnector.h.

◆ execute() [4/6]

Results benchmax::DBAL::execute ( Statement stmt,
const std::string &  a1,
const std::string &  a2,
const Index a3 
)
inline

Execute a statement with two strings and an index.

Definition at line 72 of file Database_mysqlconnector.h.

◆ execute() [5/6]

Results benchmax::DBAL::execute ( Statement stmt,
const std::string &  a1,
std::size_t  a2 
)
inline

Execute a statement with a string and a number.

Definition at line 66 of file Database_mysqlconnector.h.

◆ execute() [6/6]

Results benchmax::DBAL::execute ( Statement stmt,
int  a1,
std::size_t  a2,
std::size_t  a3,
const Index a4,
const Index a5,
const Index a6 
)
inline

Execute a statement with an int, two numbers and three indices.

Definition at line 79 of file Database_mysqlconnector.h.

◆ getIndex() [1/2]

Index benchmax::DBAL::getIndex ( const Results res,
const std::string &  name 
)
inline

Get the index of some name within the results.

Definition at line 110 of file Database_mysqlconnector.h.

◆ getIndex() [2/2]

Index benchmax::DBAL::getIndex ( const Results res,
const std::string &  name 
)
inline

Definition at line 49 of file Database_mysqlpp.h.

◆ insert() [1/2]

template<typename... Args>
Index benchmax::DBAL::insert ( const std::string &  query,
const Args &...  args 
)
inline

Insert some data and return the new index.

Definition at line 90 of file Database_mysqlconnector.h.

Here is the call graph for this function:

◆ insert() [2/2]

template<typename... Args>
Index benchmax::DBAL::insert ( const std::string &  query,
const Args &...  args 
)
inline

Definition at line 36 of file Database_mysqlpp.h.

Here is the call graph for this function:

◆ prepare() [1/2]

Statement benchmax::DBAL::prepare ( const std::string &  query)
inline

Prepare a statement.

Definition at line 53 of file Database_mysqlconnector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare() [2/2]

Statement benchmax::DBAL::prepare ( const std::string &  query)
inline

Definition at line 26 of file Database_mysqlpp.h.

◆ replacePlaceholders()

std::string benchmax::DBAL::replacePlaceholders ( const std::string &  s)
inlineprivate

Definition at line 21 of file Database_mysqlconnector.h.

Here is the caller graph for this function:

◆ select() [1/2]

template<typename... Args>
Results benchmax::DBAL::select ( const std::string &  query,
const Args &...  args 
)
inline

Select some data.

Definition at line 101 of file Database_mysqlconnector.h.

Here is the call graph for this function:

◆ select() [2/2]

template<typename... Args>
Results benchmax::DBAL::select ( const std::string &  query,
const Args &...  args 
)
inline

Definition at line 42 of file Database_mysqlpp.h.

Here is the call graph for this function:

◆ size() [1/2]

std::size_t benchmax::DBAL::size ( const Results res)
inline

Return the size of the results.

Definition at line 106 of file Database_mysqlconnector.h.

◆ size() [2/2]

std::size_t benchmax::DBAL::size ( const Results res)
inline

Definition at line 46 of file Database_mysqlpp.h.

Field Documentation

◆ conn [1/2]

std::unique_ptr<sql::Connection> benchmax::DBAL::conn
private

Definition at line 20 of file Database_mysqlconnector.h.

◆ conn [2/2]

mysqlpp::Connection benchmax::DBAL::conn
private

Definition at line 17 of file Database_mysqlpp.h.

◆ driver

std::unique_ptr<sql::Driver> benchmax::DBAL::driver
private

Definition at line 19 of file Database_mysqlconnector.h.


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