blob: f561746f9ea0b5b737712ea0d34112c5cc276aad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/** Implementation of pqxx::errorhandler and helpers.
*
* pqxx::errorhandler allows programs to receive errors and warnings.
*
* Copyright (c) 2000-2019, Jeroen T. Vermeulen.
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*/
#include "pqxx/compiler-internal.hxx"
#include "pqxx/connection_base"
#include "pqxx/errorhandler"
#include "pqxx/internal/gates/connection-errorhandler.hxx"
using namespace pqxx;
using namespace pqxx::internal;
pqxx::errorhandler::errorhandler(connection_base &conn) :
m_home{&conn}
{
gate::connection_errorhandler{*m_home}.register_errorhandler(this);
}
pqxx::errorhandler::~errorhandler()
{
unregister();
}
void pqxx::errorhandler::unregister() noexcept
{
if (m_home != nullptr)
{
gate::connection_errorhandler connection_gate{*m_home};
m_home = nullptr;
connection_gate.unregister_errorhandler(this);
}
}
|