16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
22 #include "pqxx/result.hxx"
23 #include "pqxx/transaction_base.hxx"
122 [[nodiscard]]
static difference_type backward_all() noexcept;
132 [[nodiscard]] std::
string const &name() const noexcept {
return m_name; }
142 #include <pqxx/internal/sql_cursor.hxx>
154 template<cursor_base::update_policy up, cursor_base::ownership_policy op>
171 m_cur{trans, query, cname,
cursor_base::random_access, up, op, hold}
182 m_cur{trans, adopted_cursor, op}
194 void close() noexcept { m_cur.close(); }
202 return internal::obtain_stateless_cursor_size(m_cur);
219 return internal::stateless_cursor_retrieve(
224 [[nodiscard]] std::string
const &
name() const noexcept
230 internal::sql_cursor m_cur;
234 class icursor_iterator;
240 class icursor_iterator_icursorstream;
241 class icursorstream_icursor_iterator;
315 operator bool() const noexcept {
return not m_done; }
355 void set_stride(difference_type stride);
361 friend class internal::gate::icursorstream_icursor_iterator;
368 internal::sql_cursor m_cur;
440 return not operator==(rhs);
449 return not(*
this > rhs);
453 return not(*
this < rhs);
457 void refresh()
const;
459 friend class internal::gate::icursor_iterator_icursorstream;
461 void fill(
result const &);
465 difference_type m_pos;
466 icursor_iterator *m_prev{
nullptr}, *m_next{
nullptr};
470 #include "pqxx/internal/compiler-internal-post.hxx"
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
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:41
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:117
result_size_type size_type
Definition: cursor.hxx:43
cursor_base(cursor_base const &)=delete
access_policy
Cursor access-pattern policy.
Definition: cursor.hxx:51
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
ownership_policy
Cursor destruction policy.
Definition: cursor.hxx:87
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:89
update_policy
Cursor update policy.
Definition: cursor.hxx:63
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
result_difference_type difference_type
Definition: cursor.hxx:44
std::string const m_name
Definition: cursor.hxx:137
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:156
std::string const & name() const noexcept
Return this cursor's name.
Definition: cursor.hxx:224
void close() noexcept
Close this cursor.
Definition: cursor.hxx:194
stateless_cursor(transaction_base &trans, std::string_view adopted_cursor)
Adopt an existing scrolling SQL cursor.
Definition: cursor.hxx:181
result_size_type size_type
Definition: cursor.hxx:158
result_difference_type difference_type
Definition: cursor.hxx:159
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:217
stateless_cursor(transaction_base &trans, std::string_view query, std::string_view cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:200
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:264
icursorstream & get(result &res)
Read new value into given result object; same as operator >>.
Definition: cursor.hxx:326
cursor_base::size_type size_type
Definition: cursor.hxx:266
difference_type stride() const noexcept
Definition: cursor.hxx:356
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result&).
Definition: cursor.hxx:340
cursor_base::difference_type difference_type
Definition: cursor.hxx:267
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:407
result const * operator->() const
Definition: cursor.hxx:427
bool operator!=(icursor_iterator const &rhs) const noexcept
Definition: cursor.hxx:438
result const * pointer
Definition: cursor.hxx:411
bool operator>=(icursor_iterator const &rhs) const
Definition: cursor.hxx:451
bool operator>(icursor_iterator const &rhs) const
Definition: cursor.hxx:443
result const & reference
Definition: cursor.hxx:412
istream_type::difference_type difference_type
Definition: cursor.hxx:415
std::input_iterator_tag iterator_category
Definition: cursor.hxx:409
bool operator<=(icursor_iterator const &rhs) const
Definition: cursor.hxx:447
istream_type::size_type size_type
Definition: cursor.hxx:414
Reference to a field in a result set.
Definition: field.hxx:34
Result set containing data returned by a query or command.
Definition: result.hxx:71
result_difference_type difference_type
Definition: result.hxx:74
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:76