The connection and transaction operations a driver provides, as free functions found by argument-dependent lookup on its connection handle struct.
More...
template<typename D>
D::Connection const& constConnection,
bool enabled,
SqlIsolationMode isolationMode,
CloseDiagnostic closeDiagnostic,
SqlResult result,
std::source_location location) {
{
Allocate(connection) } -> std::same_as<void>;
{
Close(connection, closeDiagnostic) } -> std::same_as<std::expected<void, SqlErrorInfo>>;
{ Disconnect(connection) } -> std::same_as<SqlResult>;
{ IsAllocated(constConnection) } -> std::same_as<bool>;
{
IsAlive(constConnection) } -> std::same_as<bool>;
{
LastError(constConnection) } -> std::same_as<SqlErrorInfo>;
{
ServerName(constConnection) } -> std::same_as<std::string>;
{
DriverName(constConnection) } -> std::same_as<std::string>;
{
DatabaseName(constConnection) } -> std::same_as<std::string>;
{
UserName(constConnection) } -> std::same_as<std::string>;
{
SetAutoCommit(connection, enabled) } -> std::same_as<SqlResult>;
{
Commit(connection) } -> std::same_as<SqlResult>;
{
Rollback(connection) } -> std::same_as<SqlResult>;
{
SetIsolation(connection, isolationMode) } -> std::same_as<SqlResult>;
{
CheckResult(constConnection, result, location) } -> std::same_as<CallOutcome>;
{
SearchPatternEscape(constConnection) } -> std::same_as<std::expected<std::string, SqlErrorInfo>>;
}
std::string ServerVersion(ConnectionHandle const &connection)
The version of the DBMS the connection is connected to.
bool TransactionActive(ConnectionHandle const &connection) noexcept
Tells whether a transaction is open, i.e. autocommit is off.
void Allocate(ConnectionHandle &connection) noexcept
Allocates the driver's connection resources, unless the connection already holds them.
SqlResult SetAutoCommit(ConnectionHandle &connection, bool enabled) noexcept
Switches autocommit mode on or off.
std::string ServerName(ConnectionHandle const &connection)
The name of the DBMS the connection is connected to.
SqlResult SetIsolation(ConnectionHandle &connection, SqlIsolationMode mode) noexcept
Sets the transaction isolation level of the connection.
bool RollbackOpenTransaction(ConnectionHandle &connection) noexcept
Rolls back the open transaction and switches autocommit back on.
SqlErrorInfo LastError(ConnectionHandle const &connection)
Reads the connection's diagnostics: the first record its last failed call left.
SqlResult Commit(ConnectionHandle &connection) noexcept
Commits the open transaction.
std::string DriverName(ConnectionHandle const &connection)
The name of the driver (library) the connection runs on.
std::string UserName(ConnectionHandle const &connection)
The name of the user the connection is logged in as.
std::expected< void, SqlErrorInfo > Close(ConnectionHandle &connection, CloseDiagnostic diagnostic) noexcept
Closes the connection: disconnects it, frees its driver resources and leaves connection empty,...
SqlResult Rollback(ConnectionHandle &connection) noexcept
Rolls back the open transaction.
bool TransactionsAllowed(ConnectionHandle const &connection) noexcept
Tells whether the data source supports transactions.
std::string DatabaseName(ConnectionHandle const &connection)
The name of the database in use.
CallOutcome CheckResult(StatementHandle const &statement, SqlResult result, std::source_location location)
The non-throwing, fault-seam-aware verdict on result.
bool IsAlive(ConnectionHandle const &connection) noexcept
Tells whether the driver still considers the connection alive.
The connection and transaction operations a driver provides, as free functions found by argument-depe...
constexpr auto SearchPatternEscape
The escape character of TablesLike's pattern.
The connection and transaction operations a driver provides, as free functions found by argument-dependent lookup on its connection handle struct.
Establishing a connection is not part of it: what a connection is opened from differs per driver. Operations that can fail return the driver's result code rather than throwing, so the caller decides how to check it.
Definition at line 268 of file Concept.hpp.