16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
23#include "pqxx/result.hxx"
24#include "pqxx/transaction_base.hxx"
128 [[nodiscard]]
static difference_type backward_all() noexcept;
138 [[nodiscard]] constexpr std::
string const &name() const noexcept
151#include <pqxx/internal/sql_cursor.hxx>
163template<cursor_base::update_policy up, cursor_base::ownership_policy op>
182 m_cur{tx, query, cname,
cursor_base::random_access, up, op, hold}
193 m_cur{tx, adopted_cursor, op}
205 void close() noexcept { m_cur.close(); }
213 return internal::obtain_stateless_cursor_size(m_cur);
230 return internal::stateless_cursor_retrieve(
235 [[nodiscard]]
constexpr std::string
const &
name() const noexcept
241 internal::sql_cursor m_cur;
245class icursor_iterator;
251class icursor_iterator_icursorstream;
252class icursorstream_icursor_iterator;
326 constexpr operator bool() const &noexcept {
return not m_done; }
366 void set_stride(difference_type stride) &;
375 friend class internal::gate::icursorstream_icursor_iterator;
382 internal::sql_cursor m_cur;
454 return not operator==(rhs);
463 return not(*
this > rhs);
467 return not(*
this < rhs);
471 void refresh()
const;
473 friend class internal::gate::icursor_iterator_icursorstream;
475 void fill(
result const &);
479 difference_type m_pos;
480 icursor_iterator *m_prev{
nullptr}, *m_next{
nullptr};
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:27
int result_size_type
Number of rows in a result set.
Definition types.hxx:28
int result_difference_type
Difference between result sizes.
Definition types.hxx:31
Definition connection.hxx:99
Connection to a database.
Definition connection.hxx:185
Common definitions for cursor types.
Definition cursor.hxx:42
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition cursor.cxx:35
cursor_base & operator=(cursor_base const &)=delete
result_size_type size_type
Definition cursor.hxx:44
cursor_base(cursor_base const &)=delete
static constexpr difference_type prior() noexcept
Special value: read backwards, one row only.
Definition cursor.hxx:119
access_policy
Cursor access-pattern policy.
Definition cursor.hxx:52
@ forward_only
Cursor can move forward only.
Definition cursor.hxx:54
ownership_policy
Cursor destruction policy.
Definition cursor.hxx:88
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition cursor.hxx:90
update_policy
Cursor update policy.
Definition cursor.hxx:64
@ read_only
Cursor can be used to read data but not to write.
Definition cursor.hxx:66
result_difference_type difference_type
Definition cursor.hxx:45
std::string const m_name
Definition cursor.hxx:146
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition cursor.hxx:165
constexpr std::string const & name() const noexcept
Return this cursor's name.
Definition cursor.hxx:235
void close() noexcept
Close this cursor.
Definition cursor.hxx:205
result_size_type size_type
Definition cursor.hxx:167
result_difference_type difference_type
Definition cursor.hxx:168
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition cursor.hxx:228
stateless_cursor(transaction_base &tx, std::string_view query, std::string_view cname, bool hold)
Create cursor.
Definition cursor.hxx:179
size_type size()
Number of rows in cursor's result set.
Definition cursor.hxx:211
stateless_cursor(transaction_base &tx, std::string_view adopted_cursor)
Adopt an existing scrolling SQL cursor.
Definition cursor.hxx:192
Simple read-only cursor represented as a stream of results.
Definition cursor.hxx:275
cursor_base::size_type size_type
Definition cursor.hxx:277
icursorstream & get(result &res)
Read new value into given result object; same as operator >>.
Definition cursor.hxx:337
cursor_base::difference_type difference_type
Definition cursor.hxx:278
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result&).
Definition cursor.hxx:351
constexpr difference_type stride() const noexcept
Definition cursor.hxx:367
Approximate istream_iterator for icursorstream.
Definition cursor.hxx:421
bool operator!=(icursor_iterator const &rhs) const noexcept
Definition cursor.hxx:452
result const * operator->() const
Definition cursor.hxx:441
result const * pointer
Definition cursor.hxx:425
bool operator>=(icursor_iterator const &rhs) const
Definition cursor.hxx:465
bool operator>(icursor_iterator const &rhs) const
Definition cursor.hxx:457
result const & reference
Definition cursor.hxx:426
istream_type::difference_type difference_type
Definition cursor.hxx:429
std::input_iterator_tag iterator_category
Definition cursor.hxx:423
bool operator<=(icursor_iterator const &rhs) const
Definition cursor.hxx:461
istream_type::size_type size_type
Definition cursor.hxx:428
Reference to a field in a result set.
Definition field.hxx:35
Result set containing data returned by a query or command.
Definition result.hxx:74
result_difference_type difference_type
Definition result.hxx:77
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:77