ark::database::PqxxDatabaseConnection

Defined in header “ark/database/pqxx_connection.hh”.


An implementation of the abstract database connection which allows for executing queries against a PostgreSQL database.

Methods

  • PqxxDatabaseConnection(std::string url)
    Constructor. Initializes against the given PostgreSQL URL.

  • ~PqxxDatabaseConnection()
    Destructor.

  • void begin_transaction()
    Begins a new transaction on this connection. When this is done, all queries are batched into a single transaction. When not done, each execute_query() gets its own transaction.

  • void end_transaction()
    Ends a transaction on this connection. Commits all outstanding queries.

  • void rollback_transaction()
    Rollback a transaction on this connection. All completed work is aborted.

  • void lock_table(const std::string & table_name, const std::optional< std::chrono::seconds > & timeout)
    Locks a table. Executes SQL to lock the given table with the given timeout.

  • AbstractDatabaseResultPtr execute_query(const std::string & query, std::span< std::string > params)
    Implementation of the virtual execute method the query is executed, and it is assumed that the parameters are in the given span, ordered appropriately.