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" 42 class result_connection;
43 class result_creation;
44 class result_pipeline;
46 class result_sql_cursor;
86 m_data{make_data_pointer()},
88 m_encoding{internal::encoding_group::MONOBYTE}
91 result(result
const &rhs) noexcept =
default;
92 result(result &&rhs) noexcept =
default;
98 result &operator=(result
const &rhs) noexcept =
default;
101 result &operator=(result &&rhs) noexcept =
default;
111 [[nodiscard]]
bool operator==(result
const &)
const noexcept;
116 return not operator==(rhs);
127 template<
typename... TYPE>
auto iter()
const;
129 [[nodiscard]] const_reverse_iterator rbegin()
const;
130 [[nodiscard]] const_reverse_iterator crbegin()
const;
131 [[nodiscard]] const_reverse_iterator rend()
const;
132 [[nodiscard]] const_reverse_iterator crend()
const;
134 [[nodiscard]] const_iterator begin() const noexcept;
135 [[nodiscard]] const_iterator cbegin() const noexcept;
136 [[nodiscard]] inline const_iterator end() const noexcept;
137 [[nodiscard]] inline const_iterator cend() const noexcept;
139 [[nodiscard]] reference front() const noexcept;
140 [[nodiscard]] reference back() const noexcept;
142 [[nodiscard]] PQXX_PURE size_type size() const noexcept;
143 [[nodiscard]] PQXX_PURE
bool empty() const noexcept;
144 [[nodiscard]]
size_type capacity() const noexcept {
return size(); }
151 void swap(
result &) noexcept;
158 [[nodiscard]]
row operator[](size_type i)
const noexcept;
160 #if defined(PQXX_HAVE_MULTIDIMENSIONAL_SUBSCRIPT) 163 operator[](size_type row_num,
row_size_type col_num)
const noexcept;
167 row at(size_type)
const;
190 [[nodiscard]] PQXX_PURE
row_size_type columns() const noexcept;
197 [[nodiscard]]
char const *column_name(
row_size_type number) const &;
203 [[nodiscard]] oid column_type(
zview col_name)
const 205 return column_type(column_number(col_name));
214 return column_table(column_number(col_name));
223 return table_column(column_number(col_name));
228 [[nodiscard]] PQXX_PURE std::string
const &query() const &noexcept;
234 [[nodiscard]] PQXX_PURE oid inserted_oid() const;
240 [[nodiscard]] PQXX_PURE size_type affected_rows() const;
278 template<typename CALLABLE> inline
void for_each(CALLABLE &&func) const;
281 using data_pointer =
std::shared_ptr<internal::pq::PGresult const>;
288 make_data_pointer(internal::pq::PGresult const *res =
nullptr) noexcept
293 friend class pqxx::internal::gate::result_pipeline;
294 PQXX_PURE std::shared_ptr<std::string const> query_ptr() const noexcept
300 std::shared_ptr<std::string const> m_query;
302 internal::encoding_group m_encoding;
304 static std::string
const s_empty_string;
314 friend class pqxx::internal::gate::result_creation;
316 internal::pq::PGresult *rhs, std::shared_ptr<std::string> query,
317 internal::encoding_group enc);
319 PQXX_PRIVATE
void check_status(std::string_view desc =
""sv)
const;
321 friend class pqxx::internal::gate::result_connection;
322 friend class pqxx::internal::gate::result_row;
323 bool operator!() const noexcept
325 return m_data.get() ==
nullptr;
327 operator bool() const noexcept
329 return m_data.get() !=
nullptr;
332 [[noreturn]] PQXX_PRIVATE
void 333 throw_sql_error(std::string
const &Err, std::string
const &Query)
const;
334 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
335 PQXX_PRIVATE std::string status_error()
const;
337 friend class pqxx::internal::gate::result_sql_cursor;
338 PQXX_PURE
char const *cmd_status() const noexcept;
int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:34
const_result_iterator const_iterator
Definition: result.hxx:79
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
bool operator!=(result const &rhs) const noexcept
Compare two results for inequality.
Definition: result.hxx:114
Reference to one row in a result.
Definition: row.hxx:46
const_reverse_result_iterator const_reverse_iterator
Definition: result.hxx:82
const_iterator pointer
Definition: result.hxx:80
Reference to a field in a result set.
Definition: field.hxx:34
const_reverse_iterator reverse_iterator
Definition: result.hxx:83
row_size_type table_column(zview col_name) const
What column in its table did this column come from?
Definition: result.hxx:221
result_difference_type difference_type
Definition: result.hxx:77
void clear() noexcept
Let go of the result's data.
Definition: result.hxx:180
int result_size_type
Number of rows in a result set.
Definition: types.hxx:28
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:37
const_iterator iterator
Definition: result.hxx:81
result() noexcept
Definition: result.hxx:85
constexpr row_size_type col() const noexcept
Definition: field.hxx:265
Definition: connection.hxx:98
oid column_table(zview col_name) const
What table did this column come from?
Definition: result.hxx:212
int result_difference_type
Difference between result sizes.
Definition: types.hxx:31
void clear_result(pq::PGresult const *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:42
Result set containing data returned by a query or command.
Definition: result.hxx:73
result_size_type size_type
Definition: result.hxx:76
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:40
Internal items for libpqxx' own use. Do not use these yourself.
Definition: composite.hxx:82