There are transaction-level callbacks and query-level callbacks.
Transaction Callbacks
Transaction callbacks are passed to tip::db::pg::db_service::begin function.
- tip::db::pg::transaction_callback is called when a connection becomes available in the connection pool and a transaction starts.
- tip::db::pg::error_callback is called when a transaction cannot start for some reason or an exception happens inside the transaction. Also called if a transaction is rolled back.
- See Also
- Errors and exceptions
- Todo:
- Commit callback
Query callbacks
Query callbacks are passed to the tip::db::pg::query::run_async function ( or it's shortcut variant - tip::db::pg::query::operator() ).
- tip::db::pg::query_result_callback is called when query result data becomes available. It can be called multiple times for a single resultset if the data volume is big. When the query completes, the complete flag passed is true. If an exception is thrown in the callback, all the queries that are queued after the one running are cancelled and the transaction is rolled back.
- tip::db::pg::error_callback is called when PostgreSQL server sends an error in responce to a query.
- See Also
- Errors and exceptions