20 #include "pqxx/except.hxx"
21 #include "pqxx/types.hxx"
22 #include "pqxx/util.hxx"
23 #include "pqxx/zview.hxx"
25 #include "pqxx/internal/encodings.hxx"
36 class result_connection;
37 class result_creation;
38 class result_pipeline;
40 class result_sql_cursor;
80 m_data(make_data_pointer()),
82 m_encoding(internal::encoding_group::MONOBYTE)
102 [[nodiscard]]
bool operator==(
result const &)
const noexcept;
106 return not operator==(rhs);
117 template<
typename... TYPE>
auto iter()
const;
129 [[nodiscard]]
reference front() const noexcept;
130 [[nodiscard]]
reference back() const noexcept;
132 [[nodiscard]] PQXX_PURE
size_type size() const noexcept;
133 [[nodiscard]] PQXX_PURE
bool empty() const noexcept;
134 [[nodiscard]]
size_type capacity() const noexcept {
return size(); }
141 void swap(
result &) noexcept;
148 [[nodiscard]]
row operator[](size_type i)
const noexcept;
150 #if defined(PQXX_HAVE_MULTIDIMENSIONAL_SUBSCRIPT)
153 operator[](size_type row_num,
row_size_type col_num)
const noexcept;
157 row at(size_type)
const;
181 [[nodiscard]] PQXX_PURE
row_size_type columns() const noexcept;
187 [[nodiscard]]
char const *column_name(
row_size_type number) const &;
193 [[nodiscard]] oid column_type(
zview col_name)
const
195 return column_type(column_number(col_name));
204 return column_table(column_number(col_name));
213 return table_column(column_number(col_name));
218 [[nodiscard]] PQXX_PURE std::string
const &query() const &noexcept;
224 [[nodiscard]] PQXX_PURE oid inserted_oid() const;
230 [[nodiscard]] PQXX_PURE size_type affected_rows() const;
234 using data_pointer = std::shared_ptr<internal::pq::PGresult const>;
241 make_data_pointer(internal::pq::PGresult const *res =
nullptr)
246 friend class pqxx::internal::gate::result_pipeline;
247 PQXX_PURE std::shared_ptr<std::string const> query_ptr() const noexcept
253 std::shared_ptr<std::string const> m_query;
255 internal::encoding_group m_encoding;
257 static std::string
const s_empty_string;
265 friend class pqxx::internal::gate::result_creation;
267 internal::pq::PGresult *rhs, std::shared_ptr<std::string> query,
268 internal::encoding_group enc);
270 PQXX_PRIVATE
void check_status(std::string_view desc =
""sv)
const;
272 friend class pqxx::internal::gate::result_connection;
273 friend class pqxx::internal::gate::result_row;
274 bool operator!() const noexcept {
return m_data.get() ==
nullptr; }
275 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
277 [[noreturn]] PQXX_PRIVATE
void
278 throw_sql_error(std::string
const &Err, std::string
const &Query)
const;
279 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
280 PQXX_PRIVATE std::string status_error()
const;
282 friend class pqxx::internal::gate::result_sql_cursor;
283 PQXX_PURE
char const *cmd_status() const noexcept;
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:23
int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:30
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:36
int result_difference_type
Difference between result sizes.
Definition: types.hxx:27
int result_size_type
Number of rows in a result set.
Definition: types.hxx:24
Internal items for libpqxx' own use. Do not use these yourself.
Definition: composite.hxx:80
void clear_result(pq::PGresult const *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:37
Definition: connection.hxx:95
Reference to a field in a result set.
Definition: field.hxx:31
row_size_type col() const noexcept
Definition: field.hxx:255
Result set containing data returned by a query or command.
Definition: result.hxx:68
const_reverse_result_iterator const_reverse_iterator
Definition: result.hxx:76
row_size_type table_column(zview col_name) const
What column in its table did this column come from?
Definition: result.hxx:211
result() noexcept
Definition: result.hxx:79
result_size_type size_type
Definition: result.hxx:70
bool operator!=(result const &rhs) const noexcept
Compare two results for inequality.
Definition: result.hxx:104
const_iterator pointer
Definition: result.hxx:74
result & operator=(result const &rhs) noexcept=default
Assign one result to another.
void clear() noexcept
Let go of the result's data.
Definition: result.hxx:170
const_iterator iterator
Definition: result.hxx:75
result_difference_type difference_type
Definition: result.hxx:71
const_reverse_iterator reverse_iterator
Definition: result.hxx:77
oid column_table(zview col_name) const
What table did this column come from?
Definition: result.hxx:202
const_result_iterator const_iterator
Definition: result.hxx:73
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:43
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:38