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)
95 [[nodiscard]]
bool operator==(
result const &)
const noexcept;
98 return not operator==(rhs);
109 template<
typename... TYPE>
auto iter()
const;
121 [[nodiscard]]
reference front()
const noexcept;
122 [[nodiscard]]
reference back()
const noexcept;
124 [[nodiscard]] PQXX_PURE
size_type size()
const noexcept;
125 [[nodiscard]] PQXX_PURE
bool empty()
const noexcept;
128 void swap(
result &) noexcept;
130 [[nodiscard]]
row operator[](
size_type i)
const noexcept;
143 [[nodiscard]] PQXX_PURE
row_size_type columns()
const noexcept;
152 return column_number(name.c_str());
158 return column_number(name.
c_str());
162 [[nodiscard]]
char const *column_name(
row_size_type number)
const;
168 template<
typename STRING>[[nodiscard]] oid
column_type(STRING col_name)
const 170 return column_type(column_number(col_name));
177 template<
typename STRING>
180 return column_table(column_number(col_name));
187 template<
typename STRING>
190 return table_column(column_number(col_name));
195 [[nodiscard]] PQXX_PURE std::string
const &query()
const noexcept;
201 [[nodiscard]] PQXX_PURE oid inserted_oid()
const;
208 [[nodiscard]] PQXX_PURE
size_type affected_rows()
const;
212 using data_pointer = std::shared_ptr<internal::pq::PGresult const>;
219 make_data_pointer(internal::pq::PGresult
const *res =
nullptr)
224 friend class pqxx::internal::gate::result_pipeline;
225 PQXX_PURE std::shared_ptr<std::string> query_ptr() const noexcept
231 std::shared_ptr<std::string> m_query;
233 internal::encoding_group m_encoding;
235 static std::string
const s_empty_string;
243 friend class pqxx::internal::gate::result_creation;
245 internal::pq::PGresult *rhs, std::shared_ptr<std::string> query,
246 internal::encoding_group enc);
248 PQXX_PRIVATE
void check_status()
const;
250 friend class pqxx::internal::gate::result_connection;
251 friend class pqxx::internal::gate::result_row;
252 bool operator!() const noexcept {
return m_data.get() ==
nullptr; }
253 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
255 [[noreturn]] PQXX_PRIVATE
void 256 ThrowSQLError(std::string
const &Err, std::string
const &Query)
const;
257 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
258 PQXX_PRIVATE std::string StatusError()
const;
260 friend class pqxx::internal::gate::result_sql_cursor;
261 PQXX_PURE
char const *cmd_status() const noexcept;
265 #include "pqxx/internal/compiler-internal-post.hxx" row_size_type column_number(zview name) const
Number of given column (throws exception if it doesn't exist).
Definition: result.hxx:156
row_size_type col() const noexcept
Definition: field.hxx:215
Private namespace for libpqxx's internal use; do not access.
Definition: connection.hxx:60
constexpr char const * c_str() const noexcept
Either a null pointer, or a zero-terminated text buffer.
Definition: zview.hxx:53
Reference to one row in a result.
Definition: row.hxx:43
int result_difference_type
Difference between result sizes.
Definition: types.hxx:21
void clear_result(pq::PGresult const *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:35
row_size_type column_number(std::string const &name) const
Number of given column (throws exception if it doesn't exist).
Definition: result.hxx:150
void clear() noexcept
Definition: result.hxx:133
result() noexcept
Definition: result.hxx:82
oid column_type(STRING col_name) const
Return column's type, as an OID from the system catalogue.
Definition: result.hxx:168
result_difference_type difference_type
Definition: result.hxx:74
oid column_table(STRING col_name) const
What table did this column come from?
Definition: result.hxx:178
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
bool operator!=(result const &rhs) const noexcept
Definition: result.hxx:96
size_type capacity() const noexcept
Definition: result.hxx:126
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
row_size_type table_column(STRING col_name) const
What column in its table did this column come from?
Definition: result.hxx:188
Definition: connection.hxx:66
Result set containing data returned by a query or command.
Definition: result.hxx:70
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:32
result_size_type size_type
Definition: result.hxx:73
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:174
int result_size_type
Number of rows in a result set.
Definition: types.hxx:18
Reference to a field in a result set.
Definition: field.hxx:32
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:35