Class representing an executable sql statement. More...
#include <Statement.h>
Public Member Functions | |
Statement () | |
Constructs an empty statement. | |
Statement (std::string const &sql, Database &db) | |
Constructs a statement representing sql query. | |
Statement (std::string const &name, std::string const &sql, Database &db) | |
Constructs a server side prepared statement. | |
~Statement () | |
Statement & | operator= (Statement const &) |
Statement (Statement< BindTypes, RetTypes, CopyTypes > const &) | |
Statement & | operator= (Statement &&other) |
Move assignment. | |
Statement (Statement &&other) | |
Move construction. | |
template<typename... Args> | |
void | execute (Args...args) |
Execute the query. | |
RetTypes::RowType | get_row (int row) |
int | row_count () |
int64_t | affected_rows () |
bool | copying () |
void | end_copy () |
Finish copying into the database. | |
template<typename... Args> | |
void | copy_data (Args...args) |
Copy row into database. | |
std::string | get_sql () const |
Class representing an executable sql statement.
BindTypes, RetTypes and CopyTypes specify types to be used as arguments to the query, the types of rows returned and types of rows to copy into database if the query initiates copying respectively.
Definition at line 51 of file Statement.h.
psql::Statement< BindTypes, RetTypes, CopyTypes >::Statement | ( | ) | [inline] |
Constructs an empty statement.
Definition at line 63 of file Statement.h.
psql::Statement< BindTypes, RetTypes, CopyTypes >::Statement | ( | std::string const & | sql, |
Database & | db | ||
) | [inline] |
Constructs a statement representing sql query.
sql | query to execute |
db | connection to use |
Definition at line 76 of file Statement.h.
psql::Statement< BindTypes, RetTypes, CopyTypes >::Statement | ( | std::string const & | name, |
std::string const & | sql, | ||
Database & | db | ||
) | [inline] |
Constructs a server side prepared statement.
name | name of the statement |
sql | query to execute |
db | connection to use |
Definition at line 92 of file Statement.h.
psql::Statement< BindTypes, RetTypes, CopyTypes >::~Statement | ( | ) | [inline] |
Definition at line 104 of file Statement.h.
psql::Statement< BindTypes, RetTypes, CopyTypes >::Statement | ( | Statement< BindTypes, RetTypes, CopyTypes > const & | ) |
int64_t psql::Statement< BindTypes, RetTypes, CopyTypes >::affected_rows | ( | ) | [inline] |
Definition at line 206 of file Statement.h.
void psql::Statement< BindTypes, RetTypes, CopyTypes >::copy_data | ( | Args... | args | ) | [inline] |
Copy row into database.
The statement has to be executed before this is called and it has to initiate copying.
args |
Definition at line 250 of file Statement.h.
bool psql::Statement< BindTypes, RetTypes, CopyTypes >::copying | ( | ) | [inline] |
Definition at line 220 of file Statement.h.
void psql::Statement< BindTypes, RetTypes, CopyTypes >::end_copy | ( | ) | [inline] |
Finish copying into the database.
Definition at line 228 of file Statement.h.
void psql::Statement< BindTypes, RetTypes, CopyTypes >::execute | ( | Args... | args | ) | [inline] |
Execute the query.
Args need to correspond to supplied BindTypes
args | arguments to query |
Definition at line 161 of file Statement.h.
RetTypes::RowType psql::Statement< BindTypes, RetTypes, CopyTypes >::get_row | ( | int | row | ) | [inline] |
row | zero based index of row to retrieve |
Definition at line 182 of file Statement.h.
std::string psql::Statement< BindTypes, RetTypes, CopyTypes >::get_sql | ( | ) | const [inline] |
Definition at line 259 of file Statement.h.
Statement& psql::Statement< BindTypes, RetTypes, CopyTypes >::operator= | ( | Statement< BindTypes, RetTypes, CopyTypes > const & | ) |
int psql::Statement< BindTypes, RetTypes, CopyTypes >::row_count | ( | ) | [inline] |
Definition at line 193 of file Statement.h.