16 #include "pqxx/compiler-public.hxx" 17 #include "pqxx/compiler-internal-pre.hxx" 22 #include "pqxx/except.hxx" 23 #include "pqxx/types.hxx" 24 #include "pqxx/util.hxx" 36 class result_connection;
37 class result_creation;
39 class result_sql_cursor;
77 result() noexcept : m_data(make_data_pointer()), m_query() {}
79 m_data(rhs.m_data), m_query(rhs.m_query) {}
86 m_query = rhs.m_query;
95 bool operator==(
const result &)
const noexcept;
97 {
return !operator==(rhs); }
113 PQXX_PURE
size_type size()
const noexcept;
114 PQXX_PURE
bool empty()
const noexcept;
117 void swap(
result &) noexcept;
122 void clear() noexcept { m_data.reset(); m_query.erase(); }
136 {
return column_number(Name.c_str());}
149 {
return column_type(column_number(ColName)); }
153 {
return column_type(column_number(ColName)); }
164 {
return column_table(column_number(ColName)); }
175 {
return table_column(column_number(ColName)); }
179 PQXX_PURE
const std::string &query()
const noexcept;
185 PQXX_PURE oid inserted_oid()
const;
191 PQXX_PURE
size_type affected_rows()
const;
195 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
201 static data_pointer make_data_pointer(
202 const internal::pq::PGresult *res=
nullptr)
215 friend class pqxx::internal::gate::result_creation;
216 result(internal::pq::PGresult *rhs,
const std::string &Query);
217 PQXX_PRIVATE
void check_status()
const;
219 friend class pqxx::internal::gate::result_connection;
220 friend class pqxx::internal::gate::result_row;
221 bool operator!() const noexcept {
return !m_data.get(); }
222 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
224 [[noreturn]] PQXX_PRIVATE
void ThrowSQLError(
225 const std::string &Err,
226 const std::string &Query)
const;
227 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
228 PQXX_PRIVATE std::string StatusError()
const;
230 friend class pqxx::internal::gate::result_sql_cursor;
231 PQXX_PURE
const char *cmd_status() const noexcept;
234 #include "pqxx/compiler-internal-post.hxx" unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
Result set containing data returned by a query or command.
Definition: result.hxx:65
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:148
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
Reference to one row in a result.
Definition: row.hxx:40
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:125
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:24
result & operator=(const result &rhs) noexcept
Definition: result.hxx:81
size_type capacity() const noexcept
Definition: result.hxx:115
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:144
result() noexcept
Definition: result.hxx:77
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:170
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:22
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:35
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:96
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:152
result(const result &rhs) noexcept
Definition: result.hxx:78
result_difference_type difference_type
Definition: result.hxx:69
oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:159
Reference to a field in a result set.
Definition: field.hxx:48
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:163
void clear() noexcept
Definition: result.hxx:122
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:174
result_size_type size_type
Definition: result.hxx:68
row_size_type column_number(const std::string &Name) const
Number of given column (throws exception if it doesn't exist).
Definition: result.hxx:135