19 #include "pqxx/result.hxx"
20 #include "pqxx/transaction_base.hxx"
119 [[nodiscard]]
static difference_type backward_all() noexcept;
129 [[nodiscard]] std::
string const &name() const noexcept {
return m_name; }
139 #include <pqxx/internal/sql_cursor.hxx>
151 template<cursor_base::update_policy up, cursor_base::ownership_policy op>
170 m_cur{tx, query, cname,
cursor_base::random_access, up, op, hold}
181 m_cur{tx, adopted_cursor, op}
193 void close() noexcept { m_cur.close(); }
201 return internal::obtain_stateless_cursor_size(m_cur);
218 return internal::stateless_cursor_retrieve(
223 [[nodiscard]] std::string
const &
name() const noexcept
229 internal::sql_cursor m_cur;
233 class icursor_iterator;
239 class icursor_iterator_icursorstream;
240 class icursorstream_icursor_iterator;
314 operator bool() const &noexcept {
return not m_done; }
354 void set_stride(difference_type stride) &;
360 friend class internal::gate::icursorstream_icursor_iterator;
367 internal::sql_cursor m_cur;
439 return not operator==(rhs);
448 return not(*
this > rhs);
452 return not(*
this < rhs);
456 void refresh()
const;
458 friend class internal::gate::icursor_iterator_icursorstream;
460 void fill(
result const &);
464 difference_type m_pos;
465 icursor_iterator *m_prev{
nullptr}, *m_next{
nullptr};
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:23
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
Definition: connection.hxx:95
Connection to a database.
Definition: connection.hxx:181
Common definitions for cursor types.
Definition: cursor.hxx:38
cursor_base & operator=(cursor_base const &)=delete
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:32
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:114
result_size_type size_type
Definition: cursor.hxx:40
cursor_base(cursor_base const &)=delete
access_policy
Cursor access-pattern policy.
Definition: cursor.hxx:48
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:50
ownership_policy
Cursor destruction policy.
Definition: cursor.hxx:84
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:86
update_policy
Cursor update policy.
Definition: cursor.hxx:60
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:62
result_difference_type difference_type
Definition: cursor.hxx:41
std::string const m_name
Definition: cursor.hxx:134
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:153
std::string const & name() const noexcept
Return this cursor's name.
Definition: cursor.hxx:223
void close() noexcept
Close this cursor.
Definition: cursor.hxx:193
result_size_type size_type
Definition: cursor.hxx:155
result_difference_type difference_type
Definition: cursor.hxx:156
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:216
stateless_cursor(transaction_base &tx, std::string_view query, std::string_view cname, bool hold)
Create cursor.
Definition: cursor.hxx:167
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:199
stateless_cursor(transaction_base &tx, std::string_view adopted_cursor)
Adopt an existing scrolling SQL cursor.
Definition: cursor.hxx:180
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:263
icursorstream & get(result &res)
Read new value into given result object; same as operator >>.
Definition: cursor.hxx:325
cursor_base::size_type size_type
Definition: cursor.hxx:265
difference_type stride() const noexcept
Definition: cursor.hxx:355
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result&).
Definition: cursor.hxx:339
cursor_base::difference_type difference_type
Definition: cursor.hxx:266
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:406
result const * operator->() const
Definition: cursor.hxx:426
bool operator!=(icursor_iterator const &rhs) const noexcept
Definition: cursor.hxx:437
result const * pointer
Definition: cursor.hxx:410
bool operator>=(icursor_iterator const &rhs) const
Definition: cursor.hxx:450
bool operator>(icursor_iterator const &rhs) const
Definition: cursor.hxx:442
result const & reference
Definition: cursor.hxx:411
istream_type::difference_type difference_type
Definition: cursor.hxx:414
std::input_iterator_tag iterator_category
Definition: cursor.hxx:408
bool operator<=(icursor_iterator const &rhs) const
Definition: cursor.hxx:446
istream_type::size_type size_type
Definition: cursor.hxx:413
Reference to a field in a result set.
Definition: field.hxx:31
Result set containing data returned by a query or command.
Definition: result.hxx:68
result_difference_type difference_type
Definition: result.hxx:71
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:73