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" 38 class result_connection;
39 class result_creation;
41 class result_sql_cursor;
79 result() noexcept : m_data(make_data_pointer()), m_query() {}
81 m_data(rhs.m_data), m_query(rhs.m_query) {}
88 m_query = rhs.m_query;
97 bool operator==(
const result &)
const noexcept;
99 {
return !operator==(rhs); }
115 PQXX_PURE
size_type size()
const noexcept;
116 PQXX_PURE
bool empty()
const noexcept;
119 void swap(
result &) noexcept;
124 void clear() noexcept { m_data.reset(); m_query.erase(); }
138 {
return column_number(Name.c_str());}
151 {
return column_type(column_number(ColName)); }
155 {
return column_type(column_number(ColName)); }
166 {
return column_table(column_number(ColName)); }
177 {
return table_column(column_number(ColName)); }
181 PQXX_PURE
const std::string &query()
const noexcept;
187 PQXX_PURE oid inserted_oid()
const;
193 PQXX_PURE
size_type affected_rows()
const;
197 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
203 static data_pointer make_data_pointer(
204 const internal::pq::PGresult *res=
nullptr)
217 friend class pqxx::internal::gate::result_creation;
218 result(internal::pq::PGresult *rhs,
const std::string &Query);
219 PQXX_PRIVATE
void check_status()
const;
221 friend class pqxx::internal::gate::result_connection;
222 friend class pqxx::internal::gate::result_row;
223 bool operator!() const noexcept {
return !m_data.get(); }
224 operator bool() const noexcept {
return m_data.get() !=
nullptr; }
226 [[noreturn]] PQXX_PRIVATE
void ThrowSQLError(
227 const std::string &Err,
228 const std::string &Query)
const;
229 PQXX_PRIVATE PQXX_PURE
int errorposition()
const;
230 PQXX_PRIVATE std::string StatusError()
const;
232 friend class pqxx::internal::gate::result_sql_cursor;
233 PQXX_PURE
const char *cmd_status() const noexcept;
236 #include "pqxx/compiler-internal-post.hxx" oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:161
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:98
result(const result &rhs) noexcept
Definition: result.hxx:80
Reference to one row in a result.
Definition: row.hxx:40
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:154
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:125
result_difference_type difference_type
Definition: result.hxx:71
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
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:165
void clear() noexcept
Definition: result.hxx:124
result() noexcept
Definition: result.hxx:79
Result set containing data returned by a query or command.
Definition: result.hxx:67
result_size_type size_type
Definition: result.hxx:70
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
size_type capacity() const noexcept
Definition: result.hxx:117
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:150
row_size_type column_number(const std::string &Name) const
Number of given column (throws exception if it doesn't exist).
Definition: result.hxx:137
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
result & operator=(const result &rhs) noexcept
Definition: result.hxx:83
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:24
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:172
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:146
Reference to a field in a result set.
Definition: field.hxx:41
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:176
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30