16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
23 #include "pqxx/except.hxx"
24 #include "pqxx/types.hxx"
25 #include "pqxx/util.hxx"
26 #include "pqxx/zview.hxx"
28 #include "pqxx/internal/encodings.hxx"
39 class result_connection;
40 class result_creation;
41 class result_pipeline;
43 class result_sql_cursor;
83 m_data(make_data_pointer()),
85 m_encoding(internal::encoding_group::MONOBYTE)
105 [[nodiscard]]
bool operator==(
result const &)
const noexcept;
109 return not operator==(rhs);
120 template<
typename... TYPE>
auto iter()
const;
132 [[nodiscard]]
reference front() const noexcept;
133 [[nodiscard]]
reference back() const noexcept;
135 [[nodiscard]] PQXX_PURE
size_type size() const noexcept;
136 [[nodiscard]] PQXX_PURE
bool empty() const noexcept;
137 [[nodiscard]]
size_type capacity() const noexcept {
return size(); }
144 void swap(
result &) noexcept;
147 [[nodiscard]]
row operator[](size_type i)
const noexcept;
149 row at(size_type)
const;
170 [[nodiscard]] PQXX_PURE
row_size_type columns() const noexcept;
176 [[nodiscard]]
char const *column_name(
row_size_type number) const;
182 [[nodiscard]] oid column_type(
zview col_name)
const
184 return column_type(column_number(col_name));
193 return column_table(column_number(col_name));
202 return table_column(column_number(col_name));
207 [[nodiscard]] PQXX_PURE std::string
const &query() const noexcept;
213 [[nodiscard]] PQXX_PURE oid inserted_oid() const;
220 [[nodiscard]] PQXX_PURE size_type affected_rows() const;
224 using data_pointer = std::shared_ptr<internal::pq::PGresult const>;
231 make_data_pointer(internal::pq::PGresult const *res =
nullptr)
236 friend class pqxx::internal::gate::result_pipeline;
237 PQXX_PURE std::shared_ptr<std::string> query_ptr() const noexcept
243 std::shared_ptr<std::string> m_query;
245 internal::encoding_group m_encoding;
247 static std::string
const s_empty_string;
255 friend class pqxx::internal::gate::result_creation;
257 internal::pq::PGresult *rhs, std::shared_ptr<std::string> query,
258 internal::encoding_group enc);
260 PQXX_PRIVATE
void check_status(std::string_view desc =
""sv)
const;
262 friend class pqxx::internal::gate::result_connection;
263 friend class pqxx::internal::gate::result_row;
264 bool operator!() const noexcept {
return m_data.get() ==
nullptr; }
265 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
267 [[noreturn]] PQXX_PRIVATE
void
268 throw_sql_error(std::string
const &Err, std::string
const &Query)
const;
269 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
270 PQXX_PRIVATE std::string status_error()
const;
272 friend class pqxx::internal::gate::result_sql_cursor;
273 PQXX_PURE
char const *cmd_status() const noexcept;
277 #include "pqxx/internal/compiler-internal-post.hxx"
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
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:74
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:34
row_size_type col() const noexcept
Definition: field.hxx:258
Result set containing data returned by a query or command.
Definition: result.hxx:71
row_size_type table_column(zview col_name) const
What column in its table did this column come from?
Definition: result.hxx:200
result() noexcept
Definition: result.hxx:82
result_size_type size_type
Definition: result.hxx:73
bool operator!=(result const &rhs) const noexcept
Compare two results for inequality.
Definition: result.hxx:107
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:159
result_difference_type difference_type
Definition: result.hxx:74
oid column_table(zview col_name) const
What table did this column come from?
Definition: result.hxx:191
result(result const &rhs) noexcept=default
auto iter() const
Iterate rows, reading them directly into a tuple of "TYPE...".
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:197
Reference to one row in a result.
Definition: row.hxx:46
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:40