Abstract base class for database connections.
More...
#include <relx/connection/connection.hpp>
Abstract base class for database connections.
Definition at line 102 of file connection.hpp.
◆ ~Connection()
| virtual relx::connection::Connection::~Connection |
( |
| ) |
|
|
virtualdefault |
◆ begin_transaction()
◆ commit_transaction()
| virtual ConnectionResult< void > relx::connection::Connection::commit_transaction |
( |
| ) |
|
|
pure virtual |
◆ connect()
◆ disconnect()
◆ execute() [1/2]
template<query::SqlExpr Query>
Execute a query expression.
- Parameters
-
| query | The query expression to execute |
- Returns
- Result containing the query results or an error
Definition at line 128 of file connection.hpp.
◆ execute() [2/2]
template<typename T , query::SqlExpr Query>
| ConnectionResult< T > relx::connection::Connection::execute |
( |
const Query & |
query | ) |
|
|
inline |
Execute a query and map results to a user-defined type using Boost.PFR.
- Note
- The struct must be an aggregate type (has no virtual functions or private members)
-
The struct should have public members in the same order as the columns in the result set
- Template Parameters
-
| T | The user-defined type to map results to |
| Query | The query expression type |
- Parameters
-
| query | The query expression to execute |
- Returns
- Result containing the mapped user-defined type or an error
Definition at line 143 of file connection.hpp.
◆ execute_many()
template<typename T , query::SqlExpr Query>
| ConnectionResult< std::vector< T > > relx::connection::Connection::execute_many |
( |
const Query & |
query | ) |
|
|
inline |
Execute a query and map results to a vector of user-defined types.
- Template Parameters
-
| T | The user-defined type to map results to |
| Query | The query expression type |
- Parameters
-
| query | The query expression to execute |
- Returns
- Result containing a vector of mapped user-defined types or an error
Definition at line 211 of file connection.hpp.
◆ execute_raw()
Execute a raw SQL query with parameters.
- Parameters
-
| sql | The SQL query string |
| params | Vector of parameter values |
- Returns
- Result containing the query results or an error
Implemented in relx::connection::PostgreSQLConnection.
◆ in_transaction()
| virtual bool relx::connection::Connection::in_transaction |
( |
| ) |
const |
|
pure virtual |
◆ is_connected()
| virtual bool relx::connection::Connection::is_connected |
( |
| ) |
const |
|
pure virtual |
◆ rollback_transaction()
| virtual ConnectionResult< void > relx::connection::Connection::rollback_transaction |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: