PostgreSQL backend. More...
#include <StormByte/database/postgres/postgres.hxx>


Public Member Functions | |
| Postgres (const Postgres &db)=delete | |
| Copy constructor (deleted). | |
| Postgres (Postgres &&db) noexcept | |
| Move constructor that transfers the database connection. | |
| Postgres & | operator= (const Postgres &db)=delete |
| Copy assignment (deleted). | |
| Postgres & | operator= (Postgres &&db) noexcept |
| Move assignment that transfers the database connection. | |
| ~Postgres () noexcept override | |
| Destructor. | |
| ExpectedRows | Query (std::string_view query) noexcept override |
| Execute a query that returns rows. | |
| bool | SilentQuery (std::string_view query) noexcept override |
| Execute a query that does not return rows. | |
Public Member Functions inherited from StormByte::Database::Database | |
| Database (const StormByte::Shared< Logger::Log > &logger) | |
| Construct with an optional logger. | |
| Database (const Database &)=delete | |
| Copy constructor (deleted). | |
| Database (Database &&other) noexcept | |
| Move constructor. | |
| Database & | operator= (const Database &)=delete |
| Copy assignment (deleted). | |
| Database & | operator= (Database &&other) noexcept |
| Move assignment. | |
| virtual | ~Database () noexcept |
| Destructor. | |
| StormByte::Shared< Telemetry > | GetTelemetry () const noexcept |
| Obtain the cumulative connection telemetry handle. | |
| bool | Connect () noexcept |
| Connect. | |
| void | Disconnect () noexcept |
| Disconnect. | |
| bool | IsConnected () const noexcept |
| Whether the connection is open. | |
| void | SetSslMode (SslMode mode) noexcept |
| TLS policy for the next Connect(). | |
| SslMode | GetSslMode () const noexcept |
| Current TLS policy. | |
| template<typename... Args> | |
| ExpectedRows | ExecuteSTMT (std::string_view name, Args &&...args) |
| Execute a prepared statement by name. | |
| Expected< Transaction, TransactionError > | BeginTransaction (IsolationLevel level=IsolationLevel::Default) |
| Begin a transaction. | |
| void | CommitTransaction () |
| Commit the current transaction. | |
| void | RollbackTransaction () |
| Roll back the current transaction. | |
Protected Member Functions | |
| Postgres (std::string_view host, std::string_view user, std::string_view password, std::string_view db_name, const StormByte::Shared< Logger::Log > &logger) | |
| Copy connection parameters into the backend. | |
| bool | DoSilentQuery (std::string_view query) noexcept override |
| Internal silent query. | |
Protected Member Functions inherited from StormByte::Database::Database | |
| void | SetTelemetry (StormByte::Shared< Telemetry > telemetry) noexcept |
| Replace the telemetry implementation, normally in a concrete backend constructor. | |
| void | RecordBackendEvent (BackendEvent event) noexcept |
| Record a categorized event reported by the active backend. | |
| Telemetry::OperationScope | TrackOperation (Operation operation) const noexcept |
| Start timing a Database operation without invoking user callbacks. | |
| void | ClearPreparedSTMTs () noexcept |
| Destroy all registered statements inside the Database module. | |
| void | PrepareSTMT (std::string_view name, std::string_view query) noexcept |
Register a prepared statement under name. | |
| void | DoPrepareSTMT (std::string_view name, std::string_view query) noexcept |
| Same as PrepareSTMT; kept for hook symmetry. | |
| virtual void | DoPreConnect () noexcept |
| Pre-connect hook. | |
| virtual void | DoPostConnect () noexcept |
| Post-connect hook. | |
| virtual void | DoPostDisconnect () noexcept |
| Post-disconnect hook. | |
Additional Inherited Members | |
Protected Attributes inherited from StormByte::Database::Database | |
| StormByte::Shared< std::recursive_mutex > | m_operation_mutex |
| DLL-safe owner of the connection mutex. | |
| StormByte::Shared< Telemetry > | m_telemetry |
| Shared cumulative counters for this connection. | |
| bool | m_connected |
| Connection state. | |
| SslMode | m_ssl_mode |
| TLS policy for network backends. | |
| StormByte::Shared< Logger::Log > | m_logger |
| Shared logger, safe across the DLL boundary. | |
PostgreSQL backend.
@note Built-in connection operations are serialized. Transactions must stay on their creating thread.
|
delete |
Copy constructor (deleted).
|
noexcept |
Move constructor that transfers the database connection.
| db | Database to move from. |
|
overridenoexcept |
Destructor.
|
protected |
|
overrideprotectedvirtualnoexcept |
Internal silent query.
| query | SQL text. |
Implements StormByte::Database::Database.
Copy assignment (deleted).
Move assignment that transfers the database connection.
| db | Database to move from. |
|
overridevirtualnoexcept |
Execute a query that returns rows.
| query | SQL text. |
Implements StormByte::Database::Database.
|
overridevirtualnoexcept |
Execute a query that does not return rows.
| query | SQL text. |
Implements StormByte::Database::Database.