aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libpqxx/include/pqxx/connectionpolicy.hxx
blob: 3eebf9edbeddc6757123a52c4884e99854069d79 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/** Definition of the connection policy classes.
 *
 * Interface for defining connection policies
 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
 *
 * 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.
 */
#ifndef PQXX_H_CONNECTIONPOLICY
#define PQXX_H_CONNECTIONPOLICY

#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"

#include <string>

#include "pqxx/internal/libpq-forward.hxx"


namespace pqxx
{

/**
 * @addtogroup connection Connection classes
 */
//@{

class PQXX_LIBEXPORT connectionpolicy
{
public:
  using handle = internal::pq::PGconn *;

  explicit connectionpolicy(const std::string &opts);
  virtual ~connectionpolicy() noexcept;

  const std::string &options() const noexcept { return m_options; }

  virtual handle do_startconnect(handle orig);
  virtual handle do_completeconnect(handle orig);
  virtual handle do_dropconnect(handle orig) noexcept;
  virtual handle do_disconnect(handle orig) noexcept;
  virtual bool is_ready(handle) const noexcept;

protected:
  handle normalconnect(handle);

private:
  std::string m_options;
};

//@}
} // namespace

#include "pqxx/compiler-internal-post.hxx"

#endif