│ │ │ │ -
315 exec(std::stringstream
const &query, std::string_view desc)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
246 m_lower{lower}, m_upper{upper}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
252 "Range's lower bound (", *lower.
value(),
│ │ │ │ +
253 ") is greater than its upper bound (", *upper.
value(),
").")};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
262 m_upper{exclusive_bound<TYPE>{TYPE{}}}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
266 noexcept(
noexcept(this->lower_bound() == rhs.lower_bound()) and
noexcept(
│ │ │ │ +
267 this->upper_bound() == rhs.upper_bound()) and
noexcept(this->empty()))
│ │ │ │ +
│ │ │ │ +
269 return (this->lower_bound() == rhs.lower_bound() and
│ │ │ │ +
270 this->upper_bound() == rhs.upper_bound()) or
│ │ │ │ +
271 (this->empty() and rhs.empty());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
275 noexcept(
noexcept(*
this == rhs))
│ │ │ │ +
│ │ │ │ +
277 return not(*
this == rhs);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
295 noexcept(noexcept(m_lower.is_exclusive()) and noexcept(
│ │ │ │ +
296 m_lower.is_limited()) and noexcept(*m_lower.value() < *m_upper.value()))
│ │ │ │ +
│ │ │ │ +
298 return (m_lower.is_exclusive() or m_upper.is_exclusive()) and
│ │ │ │ +
299 m_lower.is_limited() and m_upper.is_limited() and
│ │ │ │ +
300 not(*m_lower.value() < *m_upper.value());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
304 constexpr bool contains(TYPE value)
const noexcept(
noexcept(
│ │ │ │ +
305 m_lower.extends_down_to(value)) and
noexcept(m_upper.extends_up_to(value)))
│ │ │ │ +
│ │ │ │ +
307 return m_lower.extends_down_to(value) and m_upper.extends_up_to(value);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
315 noexcept(
noexcept((*
this & other) == other))
│ │ │ │
│ │ │ │ -
317#include "pqxx/internal/ignore-deprecated-pre.hxx"
│ │ │ │ -
318 return exec(query.str(), desc);
│ │ │ │ -
319#include "pqxx/internal/ignore-deprecated-post.hxx"
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
328 [[deprecated(
"The desc parameter is going away.")]]
result
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
331#include "pqxx/internal/ignore-deprecated-pre.hxx"
│ │ │ │ -
332 return exec_n(0, query, desc);
│ │ │ │ -
333#include "pqxx/internal/ignore-deprecated-post.hxx"
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
351 [[deprecated(
"The desc parameter is going away.")]]
row
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
354#include "pqxx/internal/ignore-deprecated-pre.hxx"
│ │ │ │ -
355 return exec_n(1, query, desc).
front();
│ │ │ │ -
356#include "pqxx/internal/ignore-deprecated-post.hxx"
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
374 [[deprecated(
"The desc parameter is going away.")]]
result
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
385#include "pqxx/internal/ignore-deprecated-pre.hxx"
│ │ │ │ -
386 return exec_n(rows, query, std::string_view{});
│ │ │ │ -
387#include "pqxx/internal/ignore-deprecated-post.hxx"
│ │ │ │ -
│ │ │ │ +
317 return (*
this & other) == other;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
337 if (not this->lower_bound().is_limited())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
340 lower = this->lower_bound();
│ │ │ │ +
341 else if (*this->lower_bound().value() < *other.
lower_bound().value())
│ │ │ │ +
│ │ │ │ +
343 else if (*other.
lower_bound().value() < *this->lower_bound().value())
│ │ │ │ +
344 lower = this->lower_bound();
│ │ │ │ +
345 else if (this->lower_bound().is_exclusive())
│ │ │ │ +
346 lower = this->lower_bound();
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
351 if (not this->upper_bound().is_limited())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
354 upper = this->upper_bound();
│ │ │ │ +
355 else if (*other.
upper_bound().value() < *this->upper_bound().value())
│ │ │ │ +
│ │ │ │ +
357 else if (*this->upper_bound().value() < *other.
upper_bound().value())
│ │ │ │ +
358 upper = this->upper_bound();
│ │ │ │ +
359 else if (this->upper_bound().is_exclusive())
│ │ │ │ +
360 upper = this->upper_bound();
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
365 lower.is_limited() and upper.is_limited() and
│ │ │ │ +
366 (*upper.value() < *lower.value()))
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
369 return {lower, upper};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
376 if (lower_bound().is_inclusive())
│ │ │ │ +
│ │ │ │ +
378 else if (lower_bound().is_exclusive())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
381 if (upper_bound().is_inclusive())
│ │ │ │ +
│ │ │ │ +
383 else if (upper_bound().is_exclusive())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
386 return {lower, upper};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │
│ │ │ │ -
│ │ │ │ -
394 template<
typename TYPE>
│ │ │ │ -
395 [[deprecated(
"The desc parameter is going away.")]] TYPE
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
398#include "pqxx/internal/ignore-deprecated-pre.hxx"
│ │ │ │ -
399 row const r{exec1(query, desc)};
│ │ │ │ -
400#include "pqxx/internal/ignore-deprecated-post.hxx"
│ │ │ │ -
401 if (std::size(r) != 1)
│ │ │ │ -
│ │ │ │ -
403 "Queried single value from result with ", std::size(r),
" columns.")};
│ │ │ │ -
404 return r[0].as<TYPE>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
416 row const r{exec1(query)};
│ │ │ │ -
417 if (std::size(r) != 1)
│ │ │ │ -
│ │ │ │ -
419 "Queried single value from result with ", std::size(r),
" columns.")};
│ │ │ │ -
420 return r[0].as<TYPE>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
431 template<
typename... TYPE>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
434 return exec1(query).as<TYPE...>();
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
397 [[nodiscard]]
static inline zview
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
400 return generic_to_buf(begin, end, value);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
408 if ((end - begin) <= internal::ssize(s_empty))
│ │ │ │ +
│ │ │ │ +
410 char *here = begin + s_empty.copy(begin, std::size(s_empty));
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
420 (
static_cast<char>(value.
lower_bound().is_inclusive() ?
'[' :
'('));
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
423 if (lower !=
nullptr)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
428 if (upper !=
nullptr)
│ │ │ │ +
│ │ │ │ +
430 if ((end - here) < 2)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
433 static_cast<char>(value.
upper_bound().is_inclusive() ?
']' :
')');
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
│ │ │ │
│ │ │ │ -
445 template<
typename... TYPE>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
449 auto const rows{std::size(res)};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
453 case 1:
return {res[0].as<TYPE...>()};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
456 "Expected at most one row of data, got "sv, rows,
"."sv)};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
441 if (std::size(
text) < 3)
│ │ │ │ +
│ │ │ │ +
443 bool left_inc{
false};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
446 case '[': left_inc =
true;
break;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
453 (std::size(
text) != std::size(s_empty)) or
│ │ │ │ +
454 (
text[1] !=
'm' and
text[1] !=
'M') or
│ │ │ │ +
455 (
text[2] !=
'p' and
text[2] !=
'P') or
│ │ │ │ +
456 (
text[3] !=
't' and
text[3] !=
'T') or
│ │ │ │ +
457 (
text[4] !=
'y' and
text[4] !=
'Y'))
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
505 template<
typename... TYPE>
│ │ │ │ -
│ │ │ │ -
506 [[nodiscard]]
auto stream(std::string_view query) &
│ │ │ │ -
│ │ │ │ -
508 return pqxx::internal::stream_query<TYPE...>{*
this, query};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
537 template<
typename CALLABLE>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
542 param_types
const *
const sample{
nullptr};
│ │ │ │ -
543 auto data_stream{stream_like(query, sample)};
│ │ │ │ -
544 for (
auto const &fields : data_stream) std::apply(func, fields);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
547 template<
typename CALLABLE>
│ │ │ │ -
│ │ │ │ -
549 "pqxx::transaction_base::for_each is now called for_stream.")]]
auto
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
552 return for_stream(query, std::forward<CALLABLE>(func));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
589 return exec(query).iter<TYPE...>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
603 return exec_n(rows, query).iter<TYPE...>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
618 exec(query).for_each(std::forward<CALLABLE>(func));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
662 return exec_params_n(1, query, std::forward<Args>(args)...).
front();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
670 return exec_params_n(0, query, std::forward<Args>(args)...);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
676 template<
typename... Args>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
679 auto const r{exec_params(query, std::forward<Args>(args)...)};
│ │ │ │ -
680 check_rowcount_params(rows, std::size(r));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
729 template<
typename... Args>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
733 return internal_exec_prepared(statement, pp.
make_c_params());
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
739 template<
typename... Args>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
742 return exec_prepared_n(1, statement, std::forward<Args>(args)...).
front();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
748 template<
typename... Args>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
751 return exec_prepared_n(0, statement, std::forward<Args>(args)...);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
758 template<
typename... Args>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
762 auto const r{exec_prepared(statement, std::forward<Args>(args)...)};
│ │ │ │ -
763 check_rowcount_prepared(statement, rows, std::size(r));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
799 "Set transaction-local variables using SQL SET statements.")]]
void
│ │ │ │ -
800 set_variable(std::string_view var, std::string_view value);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
806 [[deprecated(
"Read variables using SQL SHOW statements.")]] std::string
│ │ │ │ -
807 get_variable(std::string_view);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
811 [[nodiscard]] std::string_view
name() const &noexcept {
return m_name; }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
820 std::shared_ptr<std::string> rollback_cmd) :
│ │ │ │ -
821 m_conn{c}, m_name{tname}, m_rollback_cmd{rollback_cmd}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
836 void register_transaction();
│ │ │ │ -
│ │ │ │ -
839 void close() noexcept;
│ │ │ │ -
│ │ │ │ -
842 virtual
void do_commit() = 0;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
848 virtual
void do_abort();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
851 void set_rollback_cmd(std::shared_ptr<std::
string> cmd)
│ │ │ │ -
│ │ │ │ -
853 m_rollback_cmd = cmd;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
857 result direct_exec(std::string_view, std::string_view desc =
""sv);
│ │ │ │ -
│ │ │ │ -
859 direct_exec(std::shared_ptr<std::string>, std::string_view desc =
""sv);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
870 PQXX_PRIVATE
void check_pending_error();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
873 internal_exec_prepared(zview statement, internal::c_params
const &args);
│ │ │ │ -
│ │ │ │ -
875 result internal_exec_params(zview query, internal::c_params
const &args);
│ │ │ │ -
│ │ │ │ -
878 void check_rowcount_prepared(
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
884 check_rowcount_params(std::size_t expected_rows, std::size_t actual_rows);
│ │ │ │ -
│ │ │ │ -
887 [[nodiscard]] std::string description()
const;
│ │ │ │ -
│ │ │ │ -
889 friend class pqxx::internal::gate::transaction_transaction_focus;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
892 PQXX_PRIVATE
void register_pending_error(
zview)
noexcept;
│ │ │ │ -
893 PQXX_PRIVATE
void register_pending_error(std::string &&) noexcept;
│ │ │ │ -
│ │ │ │ -
896 template<typename... ARGS>
│ │ │ │ -
897 auto stream_like(std::string_view query, std::tuple<ARGS...> const *)
│ │ │ │ -
│ │ │ │ -
899 return stream<ARGS...>(query);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
910 status m_status = status::active;
│ │ │ │ -
911 bool m_registered =
false;
│ │ │ │ -
│ │ │ │ -
913 std::string m_pending_error;
│ │ │ │ -
│ │ │ │ -
916 std::shared_ptr<std::string> m_rollback_cmd;
│ │ │ │ -
│ │ │ │ -
918 static constexpr std::string_view s_type_name{
"transaction"sv};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
925std::string_view transaction_base::query_value<std::string_view>(
│ │ │ │ -
926 zview query, std::string_view desc) =
delete;
│ │ │ │ -
│ │ │ │ -
929zview transaction_base::query_value<zview>(
│ │ │ │ -
930 zview query, std::string_view desc) =
delete;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
938template<pqxx::isolation_level isolation, pqxx::write_policy rw>
│ │ │ │ -
939extern const zview begin_cmd;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
943inline constexpr zview begin_cmd<read_committed, write_policy::read_write>{
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
946inline constexpr zview begin_cmd<read_committed, write_policy::read_only>{
│ │ │ │ -
947 "BEGIN READ ONLY"_zv};
│ │ │ │ -
│ │ │ │ -
949inline constexpr zview begin_cmd<repeatable_read, write_policy::read_write>{
│ │ │ │ -
950 "BEGIN ISOLATION LEVEL REPEATABLE READ"_zv};
│ │ │ │ -
│ │ │ │ -
952inline constexpr zview begin_cmd<repeatable_read, write_policy::read_only>{
│ │ │ │ -
953 "BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY"_zv};
│ │ │ │ -
│ │ │ │ -
955inline constexpr zview begin_cmd<serializable, write_policy::read_write>{
│ │ │ │ -
956 "BEGIN ISOLATION LEVEL SERIALIZABLE"_zv};
│ │ │ │ -
│ │ │ │ -
958inline constexpr zview begin_cmd<serializable, write_policy::read_only>{
│ │ │ │ -
959 "BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY"_zv};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
962#include "pqxx/internal/stream_query_impl.hxx"
│ │ │ │ -
│ │ │ │ -
auto esc(ARGS &&...args) const
Escape string for use as SQL string literal in this transaction.
Definition transaction_base.hxx:131
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
467 std::size_t index{0};
│ │ │ │ +
│ │ │ │ +
469 static constexpr std::size_t last{1};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
473 std::optional<TYPE> lower, upper;
│ │ │ │ +
│ │ │ │ +
475 auto const field_parser{
│ │ │ │ +
476 pqxx::internal::specialize_parse_composite_field<std::optional<TYPE>>(
│ │ │ │ +
477 pqxx::internal::encoding_group::UTF8)};
│ │ │ │ +
478 field_parser(index,
text, pos, lower, last);
│ │ │ │ +
479 field_parser(index,
text, pos, upper, last);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
482 if (pos != std::size(
text))
│ │ │ │ +
│ │ │ │ +
484 char const closing{
text[pos - 1]};
│ │ │ │ +
485 if (closing !=
')' and closing !=
']')
│ │ │ │ +
│ │ │ │ +
487 bool const right_inc{closing ==
']'};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
505 return {lower_bound, upper_bound};
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
508 [[nodiscard]]
static inline constexpr std::size_t
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
511 TYPE
const *lower{value.lower_bound().value()},
│ │ │ │ +
512 *upper{value.upper_bound().value()};
│ │ │ │ +
513 std::size_t
const lsz{
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
518 return std::size(s_empty) + 1;
│ │ │ │ +
│ │ │ │ +
520 return 1 + lsz + 1 + usz + 2;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
524 static constexpr zview s_empty{
"empty"_zv};
│ │ │ │ +
525 static constexpr auto s_overrun{
"Not enough space in buffer for range."_zv};
│ │ │ │ +
│ │ │ │ +
528 static std::string err_bad_input(std::string_view text)
│ │ │ │ +
│ │ │ │ +
530 return internal::concat(
"Invalid range input: '", text,
"'");
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:33
│ │ │ │ -
std::basic_string_view< std::byte > binary_cast(TYPE const &data)
Cast binary data to a type that libpqxx will recognise as binary.
Definition util.hxx:303
│ │ │ │
│ │ │ │ -
Internal items for libpqxx' own use. Do not use these yourself.
Definition composite.hxx:84
│ │ │ │ -
decltype(strip_types(std::declval< TYPES... >())) strip_types_t
Take a tuple type and apply strip_t to its component types.
Definition util.hxx:527
│ │ │ │ -
Definition connection.hxx:112
│ │ │ │ -
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition binarystring.hxx:59
│ │ │ │ -
std::basic_string_view< std::byte > bytes_view() const
Read data as a std::basic_string_view<std::byte>.
Definition binarystring.hxx:178
│ │ │ │ -
Connection to a database.
Definition connection.hxx:253
│ │ │ │ -
Error in usage of libpqxx library, similar to std::logic_error.
Definition except.hxx:249
│ │ │ │ -
Query returned an unexpected number of rows.
Definition except.hxx:343
│ │ │ │ -
Build a parameter list for a parameterised or prepared statement.
Definition params.hxx:220
│ │ │ │ -
pqxx::internal::c_params make_c_params() const
For internal use: Generate a params object for use in calls.
Definition params.cxx:96
│ │ │ │ -
Result set containing data returned by a query or command.
Definition result.hxx:73
│ │ │ │ -
result_size_type size_type
Definition result.hxx:75
│ │ │ │ -
Reference to one row in a result.
Definition row.hxx:47
│ │ │ │ -
reference front() const noexcept
Definition row.cxx:60
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:88
│ │ │ │ -
result exec_prepared(zview statement, Args &&...args)
Execute a prepared statement, with optional arguments.
Definition transaction_base.hxx:730
│ │ │ │ -
std::basic_string< std::byte > unesc_bin(zview text)
Unescape binary data, e.g. from a table field or notification payload.
Definition transaction_base.hxx:169
│ │ │ │ -
result exec0(zview query, std::string_view desc)
Execute command, which should return zero rows of data.
Definition transaction_base.hxx:329
│ │ │ │ -
constexpr connection & conn() const noexcept
The connection in which this transaction lives.
Definition transaction_base.hxx:780
│ │ │ │ -
auto for_each(std::string_view query, CALLABLE &&func)
Definition transaction_base.hxx:550
│ │ │ │ -
auto query(zview query)
Execute query, read full results, then iterate rows of data.
Definition transaction_base.hxx:587
│ │ │ │ -
void process_notice(zview msg) const
Have connection process a warning message.
Definition transaction_base.hxx:776
│ │ │ │ -
result exec0(zview query)
Execute command, which should return zero rows of data.
Definition transaction_base.hxx:342
│ │ │ │ -
auto query_n(result::size_type rows, zview query)
Perform query, expect given number of rows, iterate results.
Definition transaction_base.hxx:601
│ │ │ │ -
std::string unesc_raw(char const *text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition transaction_base.hxx:179
│ │ │ │ -
TYPE query_value(zview query, std::string_view desc)
Perform query, expecting exactly 1 row with 1 field, and convert it.
Definition transaction_base.hxx:396
│ │ │ │ -
result exec_prepared_n(result::size_type rows, zview statement, Args &&...args)
Execute a prepared statement, expect a result with given number of rows.
Definition transaction_base.hxx:760
│ │ │ │ -
transaction_base(transaction_base const &)=delete
│ │ │ │ -
transaction_base(connection &c, std::string_view tname, std::shared_ptr< std::string > rollback_cmd)
Create a transaction (to be called by implementation classes only).
Definition transaction_base.hxx:818
│ │ │ │ -
std::string quote(T const &t) const
Represent object as SQL string, including quoting & escaping.
Definition transaction_base.hxx:197
│ │ │ │ -
row exec_params1(zview query, Args &&...args)
Definition transaction_base.hxx:660
│ │ │ │ -
TYPE query_value(zview query)
Perform query, expecting exactly 1 row with 1 field, and convert it.
Definition transaction_base.hxx:414
│ │ │ │ -
transaction_base & operator=(transaction_base const &)=delete
│ │ │ │ -
auto esc_raw(ARGS &&...args) const
Escape binary data for use as SQL string literal in this transaction.
Definition transaction_base.hxx:148
│ │ │ │ -
result exec(std::stringstream const &query, std::string_view desc)
Execute a command.
Definition transaction_base.hxx:315
│ │ │ │ -
std::string quote(binarystring const &t) const
Definition transaction_base.hxx:204
│ │ │ │ -
row exec1(zview query)
Execute command returning a single row of data.
Definition transaction_base.hxx:366
│ │ │ │ -
row exec1(zview query, std::string_view desc)
Execute command returning a single row of data.
Definition transaction_base.hxx:352
│ │ │ │ -
transaction_base(transaction_base &&)=delete
│ │ │ │ -
result exec_params(zview query, Args &&...args)
Execute an SQL statement with parameters.
Definition transaction_base.hxx:651
│ │ │ │ -
std::optional< std::tuple< TYPE... > > query01(zview query)
Query at most one row of data, and if there is one, convert it.
Definition transaction_base.hxx:446
│ │ │ │ -
transaction_base()=delete
│ │ │ │ -
result exec_params0(zview query, Args &&...args)
Definition transaction_base.hxx:668
│ │ │ │ -
auto for_stream(std::string_view query, CALLABLE &&func)
Perform a streaming query, and for each result row, call func.
Definition transaction_base.hxx:538
│ │ │ │ -
std::string unesc_raw(zview text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition transaction_base.hxx:158
│ │ │ │ -
result exec_prepared0(zview statement, Args &&...args)
Execute a prepared statement, and expect a result with zero rows.
Definition transaction_base.hxx:749
│ │ │ │ -
std::string esc_like(std::string_view bin, char escape_char='\\') const
Escape string for literal LIKE match.
Definition transaction_base.hxx:238
│ │ │ │ -
std::basic_string< std::byte > unesc_bin(char const text[])
Unescape binary data, e.g. from a table field or notification payload.
Definition transaction_base.hxx:190
│ │ │ │ -
transaction_base & operator=(transaction_base &&)=delete
│ │ │ │ -
result exec_n(result::size_type rows, zview query)
Execute command, expect given number of rows.
Definition transaction_base.hxx:383
│ │ │ │ -
std::tuple< TYPE... > query1(zview query)
Perform query returning exactly one row, and convert its fields.
Definition transaction_base.hxx:432
│ │ │ │ -
result exec(std::string_view query)
Execute a command.
Definition transaction_base.hxx:300
│ │ │ │ -
row exec_prepared1(zview statement, Args &&...args)
Execute a prepared statement, and expect a single-row result.
Definition transaction_base.hxx:740
│ │ │ │ -
std::string quote_name(std::string_view identifier) const
Escape an SQL identifier for use in a query.
Definition transaction_base.hxx:231
│ │ │ │ -
std::string quote_raw(unsigned char const bin[], std::size_t len) const
Binary-escape and quote a binary string for use as an SQL constant.
Definition transaction_base.hxx:211
│ │ │ │ -
std::string_view name() const &noexcept
Transaction name, if you passed one to the constructor; or empty string.
Definition transaction_base.hxx:811
│ │ │ │ -
result exec_params_n(std::size_t rows, zview query, Args &&...args)
Definition transaction_base.hxx:677
│ │ │ │ -
auto stream(std::string_view query) &
Execute a query, and loop over the results row by row.
Definition transaction_base.hxx:506
│ │ │ │ -
void for_query(zview query, CALLABLE &&func)
Execute a query, load the full result, and perform func for each row.
Definition transaction_base.hxx:616
│ │ │ │ -
void process_notice(char const msg[]) const
Have connection process a warning message.
Definition transaction_base.hxx:774
│ │ │ │ -
Base class for things that monopolise a transaction's attention.
Definition transaction_focus.hxx:29
│ │ │ │ +
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition except.hxx:266
│ │ │ │ +
Value conversion failed, e.g. when converting "Hello" to int.
Definition except.hxx:283
│ │ │ │ +
Could not convert value to string: not enough buffer space.
Definition except.hxx:313
│ │ │ │ +
Something is out of range, similar to std::out_of_range.
Definition except.hxx:326
│ │ │ │ +
An unlimited boundary value to a pqxx::range.
Definition range.hxx:24
│ │ │ │ +
constexpr bool extends_down_to(TYPE const &) const noexcept
Definition range.hxx:26
│ │ │ │ +
constexpr bool extends_up_to(TYPE const &) const noexcept
Definition range.hxx:31
│ │ │ │ +
An inclusive boundary value to a pqxx::range.
Definition range.hxx:43
│ │ │ │ +
constexpr inclusive_bound(TYPE const &value)
Definition range.hxx:50
│ │ │ │ +
constexpr bool extends_down_to(TYPE const &value) const noexcept(noexcept(value< m_value))
Would this bound, as a lower bound, include value?
Definition range.hxx:59
│ │ │ │ +
│ │ │ │ +
constexpr TYPE const & get() const &noexcept
Definition range.hxx:56
│ │ │ │ +
constexpr bool extends_up_to(TYPE const &value) const noexcept(noexcept(value< m_value))
Would this bound, as an upper bound, include value?
Definition range.hxx:66
│ │ │ │ +
An exclusive boundary value to a pqxx::range.
Definition range.hxx:79
│ │ │ │ +
constexpr bool extends_up_to(TYPE const &value) const noexcept(noexcept(value< m_value))
Would this bound, as an upper bound, include value?
Definition range.hxx:102
│ │ │ │ +
│ │ │ │ +
constexpr exclusive_bound(TYPE const &value)
Definition range.hxx:86
│ │ │ │ +
constexpr TYPE const & get() const &noexcept
Definition range.hxx:92
│ │ │ │ +
constexpr bool extends_down_to(TYPE const &value) const noexcept(noexcept(m_value< value))
Would this bound, as a lower bound, include value?
Definition range.hxx:95
│ │ │ │ +
A range boundary value.
Definition range.hxx:115
│ │ │ │ +
constexpr bool extends_up_to(TYPE const &value) const
Would this bound, as an upper bound, include value?
Definition range.hxx:189
│ │ │ │ +
constexpr range_bound(range_bound const &) noexcept(noexcept(inclusive_bound< TYPE >{ std::declval< inclusive_bound< TYPE > const & >()}) and noexcept(exclusive_bound< TYPE >{ std::declval< exclusive_bound< TYPE > const & >()}))=default
│ │ │ │ +
constexpr bool is_exclusive() const noexcept
Is this boundary an exclusive one?
Definition range.hxx:174
│ │ │ │ +
constexpr range_bound(inclusive_bound< TYPE > const &bound) noexcept(noexcept(inclusive_bound< TYPE >{bound}))
Definition range.hxx:124
│ │ │ │ +
constexpr bool is_limited() const noexcept
Is this a finite bound?
Definition range.hxx:162
│ │ │ │ +
constexpr TYPE const * value() const &noexcept
Return bound value, or nullptr if it's not limited.
Definition range.hxx:198
│ │ │ │ +
constexpr bool operator!=(range_bound const &rhs) const noexcept(noexcept(*this==rhs))
Definition range.hxx:153
│ │ │ │ +
constexpr bool extends_down_to(TYPE const &value) const
Would this bound, as a lower bound, include value?
Definition range.hxx:180
│ │ │ │ +
│ │ │ │ +
constexpr range_bound(no_bound) noexcept
Definition range.hxx:122
│ │ │ │ +
range_bound & operator=(range_bound const &)=default
│ │ │ │ +
constexpr bool operator==(range_bound const &rhs) const noexcept(noexcept(*this->value()== *rhs.value()))
Definition range.hxx:142
│ │ │ │ +
constexpr range_bound(exclusive_bound< TYPE > const &bound) noexcept(noexcept(exclusive_bound{bound}))
Definition range.hxx:129
│ │ │ │ +
constexpr bool is_inclusive() const noexcept
Is this boundary an inclusive one?
Definition range.hxx:168
│ │ │ │ +
range_bound & operator=(range_bound &&)=default
│ │ │ │ +
constexpr range_bound(range_bound &&)=default
│ │ │ │ +
A C++ equivalent to PostgreSQL's range types.
Definition range.hxx:234
│ │ │ │ +
constexpr range operator&(range const &other) const
Intersection of two ranges.
Definition range.hxx:334
│ │ │ │ +
constexpr bool operator==(range const &rhs) const noexcept(noexcept(this->lower_bound()==rhs.lower_bound()) and noexcept(this->upper_bound()==rhs.upper_bound()) and noexcept(this->empty()))
Definition range.hxx:265
│ │ │ │ +
constexpr bool contains(TYPE value) const noexcept(noexcept(m_lower.extends_down_to(value)) and noexcept(m_upper.extends_up_to(value)))
Does this range encompass value?
Definition range.hxx:304
│ │ │ │ +
constexpr bool contains(range< TYPE > const &other) const noexcept(noexcept((*this &other)==other))
Does this range encompass all of other?
Definition range.hxx:314
│ │ │ │ +
constexpr bool operator!=(range const &rhs) const noexcept(noexcept(*this==rhs))
Definition range.hxx:274
│ │ │ │ +
│ │ │ │ +
range(range const &)=default
│ │ │ │ +
range & operator=(range &&)=default
│ │ │ │ +
range & operator=(range const &)=default
│ │ │ │ +
constexpr range(range_bound< TYPE > lower, range_bound< TYPE > upper)
Create a range.
Definition range.hxx:245
│ │ │ │ +
constexpr range_bound< TYPE > const & upper_bound() const &noexcept
Definition range.hxx:326
│ │ │ │ +
constexpr bool empty() const noexcept(noexcept(m_lower.is_exclusive()) and noexcept(m_lower.is_limited()) and noexcept(*m_lower.value()< *m_upper.value()))
Is this range clearly empty?
Definition range.hxx:294
│ │ │ │ +
constexpr range_bound< TYPE > const & lower_bound() const &noexcept
Definition range.hxx:321
│ │ │ │ +
constexpr range() noexcept(noexcept(exclusive_bound< TYPE >{TYPE{}}))
Create an empty range.
Definition range.hxx:260
│ │ │ │ +
static constexpr std::size_t size_buffer(range< TYPE > const &value) noexcept
Definition range.hxx:509
│ │ │ │ +
static char * into_buf(char *begin, char *end, range< TYPE > const &value)
Definition range.hxx:404
│ │ │ │ +
static zview to_buf(char *begin, char *end, range< TYPE > const &value)
Definition range.hxx:398
│ │ │ │ +
static range< TYPE > from_string(std::string_view text)
Definition range.hxx:439
│ │ │ │ +
Traits describing a type's "null value," if any.
Definition strconv.hxx:93
│ │ │ │ +
Nullness traits describing a type which does not have a null value.
Definition strconv.hxx:115
│ │ │ │ +
Traits class for use in string conversions.
Definition strconv.hxx:155
│ │ │ │
Marker-type wrapper: zero-terminated std::string_view.
Definition zview.hxx:38
│ │ │ │