16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
25#include "pqxx/except.hxx"
26#include "pqxx/types.hxx"
27#include "pqxx/util.hxx"
28#include "pqxx/zview.hxx"
30#include "pqxx/internal/encodings.hxx"
35PQXX_LIBEXPORT
void clear_result(pq::PGresult
const *)
noexcept;
41class result_connection;
45class result_sql_cursor;
85 m_data{make_data_pointer()},
87 m_encoding{internal::encoding_group::MONOBYTE}
111 [[nodiscard]]
bool operator==(
result const &)
const noexcept;
115 return not operator==(rhs);
126 template<
typename... TYPE>
auto iter()
const;
138 [[nodiscard]]
reference front() const noexcept;
139 [[nodiscard]]
reference back() const noexcept;
141 [[nodiscard]] PQXX_PURE
size_type size() const noexcept;
142 [[nodiscard]] PQXX_PURE
bool empty() const noexcept;
143 [[nodiscard]]
size_type capacity() const noexcept {
return size(); }
150 void swap(
result &)
noexcept;
157 [[nodiscard]]
row operator[](size_type i)
const noexcept;
159#if pqxx_have_multidim
161 operator[](size_type row_num,
row_size_type col_num)
const noexcept;
165 row at(size_type)
const;
189 [[nodiscard]] PQXX_PURE
row_size_type columns() const noexcept;
195 [[nodiscard]]
char const *column_name(
row_size_type number) const &;
201 [[nodiscard]] oid column_type(
zview col_name)
const
203 return column_type(column_number(col_name));
212 return column_table(column_number(col_name));
221 return table_column(column_number(col_name));
226 [[nodiscard]] PQXX_PURE std::string
const &query() const &noexcept;
232 [[nodiscard]] PQXX_PURE oid inserted_oid() const;
238 [[nodiscard]] PQXX_PURE size_type affected_rows() const;
276 template<typename CALLABLE> inline
void for_each(CALLABLE &&func) const;
279 using data_pointer = std::shared_ptr<internal::pq::PGresult const>;
286 make_data_pointer(internal::pq::PGresult const *res =
nullptr) noexcept
291 friend class pqxx::internal::gate::result_pipeline;
292 PQXX_PURE std::shared_ptr<std::string const> query_ptr() const noexcept
298 std::shared_ptr<std::string const> m_query;
300 internal::encoding_group m_encoding;
302 static std::string
const s_empty_string;
305 PQXX_PURE
char const *
311 friend class pqxx::internal::gate::result_creation;
313 internal::pq::PGresult *rhs, std::shared_ptr<std::string> query,
314 internal::encoding_group enc);
316 PQXX_PRIVATE
void check_status(std::string_view desc =
""sv)
const;
318 friend class pqxx::internal::gate::result_connection;
319 friend class pqxx::internal::gate::result_row;
320 bool operator!() const noexcept {
return m_data.get() ==
nullptr; }
321 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
323 [[noreturn]] PQXX_PRIVATE PQXX_COLD
void
324 throw_sql_error(std::string
const &Err, std::string
const &Query)
const;
325 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
326 PQXX_PRIVATE std::string status_error()
const;
328 friend class pqxx::internal::gate::result_sql_cursor;
329 PQXX_PURE
char const *cmd_status() const noexcept;
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:33
int row_size_type
Number of fields in a row of database data.
Definition types.hxx:34
std::size_t field_size_type
Number of bytes in a field of database data.
Definition types.hxx:40
int result_difference_type
Difference between result sizes.
Definition types.hxx:31
int result_size_type
Number of rows in a result set.
Definition types.hxx:28
Internal items for libpqxx' own use. Do not use these yourself.
Definition composite.hxx:84
void clear_result(pq::PGresult const *) noexcept
C++ wrapper for libpq's PQclear.
Definition result.cxx:42
Definition connection.hxx:112
Reference to a field in a result set.
Definition field.hxx:35
Result set containing data returned by a query or command.
Definition result.hxx:73
const_reverse_result_iterator const_reverse_iterator
Definition result.hxx:81
result(result &&rhs) noexcept=default
row_size_type table_column(zview col_name) const
What column in its table did this column come from?
Definition result.hxx:219
result() noexcept
Definition result.hxx:84
result & operator=(result &&rhs) noexcept=default
Assign one result to another, invaliding the old one.
result_size_type size_type
Definition result.hxx:75
bool operator!=(result const &rhs) const noexcept
Compare two results for inequality.
Definition result.hxx:113
const_iterator pointer
Definition result.hxx:79
void clear() noexcept
Let go of the result's data.
Definition result.hxx:178
const_iterator iterator
Definition result.hxx:80
result_difference_type difference_type
Definition result.hxx:76
const_reverse_iterator reverse_iterator
Definition result.hxx:82
oid column_table(zview col_name) const
What table did this column come from?
Definition result.hxx:210
result & operator=(result const &rhs) noexcept=default
Assign one result to another.
const_result_iterator const_iterator
Definition result.hxx:78
result(result const &rhs) noexcept=default
auto iter() const
Iterate rows, reading them directly into a tuple of "TYPE...".
Reference to one row in a result.
Definition row.hxx:47
Marker-type wrapper: zero-terminated std::string_view.
Definition zview.hxx:38