connection-transaction.hxx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include <pqxx/internal/callgate.hxx>
  2. namespace pqxx
  3. {
  4. class connection_base;
  5. namespace internal
  6. {
  7. namespace gate
  8. {
  9. class PQXX_PRIVATE connection_transaction : callgate<connection_base>
  10. {
  11. friend class pqxx::transaction_base;
  12. connection_transaction(reference x) : super(x) {}
  13. result exec(const char query[], int retries)
  14. { return home().exec(query, retries); }
  15. void register_transaction(transaction_base *t)
  16. { home().register_transaction(t); }
  17. void unregister_transaction(transaction_base *t) noexcept
  18. { home().unregister_transaction(t); }
  19. bool read_copy_line(std::string &line)
  20. { return home().read_copy_line(line); }
  21. void write_copy_line(const std::string &line)
  22. { home().write_copy_line(line); }
  23. void end_copy_write() { home().end_copy_write(); }
  24. std::string raw_get_var(const std::string &var)
  25. { return home().raw_get_var(var); }
  26. void raw_set_var(const std::string &var, const std::string &value)
  27. { home().raw_set_var(var, value); }
  28. void add_variables(const std::map<std::string, std::string> &vars)
  29. { home().add_variables(vars); }
  30. /// @deprecated To be replaced by exec_prepared.
  31. result prepared_exec(
  32. const std::string &statement,
  33. const char *const params[],
  34. const int paramlengths[],
  35. const int binaries[],
  36. int nparams)
  37. {
  38. #include <pqxx/internal/ignore-deprecated-pre.hxx>
  39. return home().prepared_exec(
  40. statement,
  41. params,
  42. paramlengths,
  43. binaries,
  44. nparams,
  45. result_format::text);
  46. #include <pqxx/internal/ignore-deprecated-post.hxx>
  47. }
  48. result exec_prepared(
  49. const std::string &statement,
  50. const internal::params &args,
  51. result_format format)
  52. {
  53. return home().exec_prepared(statement, args, format);
  54. }
  55. result exec_params(const std::string &query, const internal::params &args)
  56. {
  57. return home().exec_params(query, args);
  58. }
  59. bool prepared_exists(const std::string &statement) const
  60. { return home().prepared_exists(statement); }
  61. void take_reactivation_avoidance(int counter)
  62. { home().m_reactivation_avoidance.add(counter); }
  63. };
  64. } // namespace pqxx::internal::gate
  65. } // namespace pqxx::internal
  66. } // namespace pqxx