connectionpolicy.hxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /** Definition of the connection policy classes.
  2. *
  3. * Interface for defining connection policies
  4. * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
  5. *
  6. * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
  7. *
  8. * See COPYING for copyright license. If you did not receive a file called
  9. * COPYING with this source code, please notify the distributor of this mistake,
  10. * or contact the author.
  11. */
  12. #ifndef PQXX_H_CONNECTIONPOLICY
  13. #define PQXX_H_CONNECTIONPOLICY
  14. #include "pqxx/compiler-public.hxx"
  15. #include "pqxx/compiler-internal-pre.hxx"
  16. #include <string>
  17. #include "pqxx/internal/libpq-forward.hxx"
  18. namespace pqxx
  19. {
  20. /**
  21. * @addtogroup connection Connection classes
  22. */
  23. //@{
  24. class PQXX_LIBEXPORT connectionpolicy
  25. {
  26. public:
  27. using handle = internal::pq::PGconn *;
  28. explicit connectionpolicy(const std::string &opts);
  29. virtual ~connectionpolicy() noexcept;
  30. const std::string &options() const noexcept { return m_options; }
  31. virtual handle do_startconnect(handle orig);
  32. virtual handle do_completeconnect(handle orig);
  33. virtual handle do_dropconnect(handle orig) noexcept;
  34. virtual handle do_disconnect(handle orig) noexcept;
  35. virtual bool is_ready(handle) const noexcept;
  36. protected:
  37. handle normalconnect(handle);
  38. private:
  39. std::string m_options;
  40. };
  41. //@}
  42. } // namespace
  43. #include "pqxx/compiler-internal-post.hxx"
  44. #endif