14 #include "pqxx/compiler-public.hxx" 22 #include <type_traits> 26 #include "pqxx/strconv.hxx" 32 #include <pqxx/internal/libpq-forward.hxx> 47 bool have_safe_strerror =
true;
53 bool safe_query_cancel =
true;
56 bool safe_result_copy =
true;
94 template<typename ITER, typename ACCESS> inline
96 const
std::
string &sep,
105 for (++begin; begin != end; ++begin)
116 template<
typename ITER>
inline std::string
118 {
return separated_list(sep, begin, end, [](ITER i){
return *i; }); }
122 template<
typename CONTAINER>
inline auto 129 ->
typename std::enable_if<
131 not std::is_void<decltype(std::begin(c))>::value
132 and not std::is_void<decltype(std::end(c))>::value
145 template<
typename T> constexpr
auto operator()( T t_p )
const 158 typename std::enable_if<
159 (INDEX == std::tuple_size<TUPLE>::value-1),
165 const std::string & ,
170 return to_string(access(&std::get<INDEX>(t)));
177 typename std::enable_if<
178 (INDEX < std::tuple_size<TUPLE>::value-1),
188 separated_list<TUPLE, INDEX+1>(sep, t, access);
194 typename std::enable_if<
195 (INDEX <= std::tuple_size<TUPLE>::value),
219 PQXX_LIBEXPORT
void freepqmem(
const void *) noexcept;
249 m_classname{Classname},
254 namedclass(
const std::string &Classname,
const std::string &Name) :
255 m_classname{Classname},
261 const std::string &
name() const noexcept {
return m_name; }
265 {
return m_classname; }
268 std::string description()
const;
271 std::string m_classname, m_name;
285 template<
typename GUEST>
293 GUEST *
get()
const noexcept {
return m_guest; }
297 CheckUniqueRegistration(G, m_guest);
303 CheckUniqueUnregistration(G, m_guest);
308 GUEST *m_guest =
nullptr;
void CheckUniqueRegistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:69
bool safe_libpq
Is the underlying libpq build thread-safe?
Definition: util.hxx:50
void ignore_unused(T)
Suppress compiler warning about an unused item.
Definition: util.hxx:38
void freepqmem(const void *) noexcept
Definition: util.cxx:103
std::string description
A human-readable description of any thread-safety issues.
Definition: util.hxx:68
namedclass(const std::string &Classname)
Definition: util.hxx:248
void CheckUniqueUnregistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:85
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:286
thread_safety_model describe_thread_safety() noexcept
Describe thread safety available in this build.
Definition: util.cxx:28
namedclass(const std::string &Classname, const std::string &Name)
Definition: util.hxx:254
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:261
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:448
Descriptor of library's thread-safety model.
Definition: util.hxx:44
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:245
void freemallocmem_templated(P *p) noexcept
Definition: util.hxx:226
const std::string & classname() const noexcept
Class name.
Definition: util.hxx:264
void freepqmem_templated(P *p) noexcept
Definition: util.hxx:220
constexpr auto operator()(T t_p) const -> decltype(*t_p)
Definition: util.hxx:145
bool safe_kerberos
Is Kerberos thread-safe?
Definition: util.hxx:65
void freemallocmem(const void *) noexcept
Definition: util.cxx:109
void sleep_seconds(int)
Sleep for the given number of seconds.
Definition: util.cxx:115
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
void register_guest(GUEST *G)
Definition: util.hxx:295
Result set containing data returned by a query or command.
Definition: result.hxx:69
void unregister_guest(GUEST *G)
Definition: util.hxx:301