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"
108 [[nodiscard]]
static constexpr difference_type
all() noexcept
110 return (std::numeric_limits<int>::max)() - 1;
116 [[nodiscard]]
static constexpr difference_type
next() noexcept {
return 1; }
121 [[nodiscard]]
static constexpr difference_type
prior() noexcept
131 return (std::numeric_limits<int>::min)() + 1;
142 [[nodiscard]]
constexpr std::string
const &
name() const noexcept
150 std::string
const m_name;
155#include <pqxx/internal/sql_cursor.hxx>
167template<cursor_base::update_policy up, cursor_base::ownership_policy op>
186 m_cur{tx, query, cname,
cursor_base::random_access, up, op, hold}
197 m_cur{tx, adopted_cursor, op}
209 void close() noexcept { m_cur.close(); }
217 return internal::obtain_stateless_cursor_size(m_cur);
234 return internal::stateless_cursor_retrieve(
235 m_cur, result::difference_type(
size()), begin_pos, end_pos);
239 [[nodiscard]]
constexpr std::string
const &
name() const noexcept
249class icursor_iterator;
253namespace pqxx::internal::gate
255class icursor_iterator_icursorstream;
256class icursorstream_icursor_iterator;
281 using size_type = cursor_base::size_type;
282 using difference_type = cursor_base::difference_type;
298 std::string_view basename, difference_type sstride = 1);
330 constexpr operator bool() const & noexcept {
return not m_done; }
370 void set_stride(difference_type stride) &;
371 [[nodiscard]]
constexpr difference_type stride() const noexcept
379 friend class internal::gate::icursorstream_icursor_iterator;
380 size_type forward(size_type n = 1);
381 void insert_iterator(icursor_iterator *)
noexcept;
382 void remove_iterator(icursor_iterator *)
const noexcept;
384 void service_iterators(difference_type);
386 internal::sql_cursor m_cur;
388 difference_type m_stride;
389 difference_type m_realpos, m_reqpos;
391 mutable icursor_iterator *m_iterators;
427 using iterator_category = std::input_iterator_tag;
429 using pointer =
result const *;
430 using reference =
result const &;
432 using size_type = istream_type::size_type;
433 using difference_type = istream_type::difference_type;
440 result const &operator*()
const
445 result const *operator->()
const
458 return not operator==(rhs);
467 return not(*
this > rhs);
471 return not(*
this < rhs);
475 void refresh()
const;
478 difference_type pos()
const noexcept {
return m_pos; }
479 void fill(
result const &);
483 difference_type m_pos;
Connection to a database.
Definition: connection.hxx:230
Common definitions for cursor types.
Definition: cursor.hxx:42
constexpr std::string const & name() const noexcept
Name of underlying SQL cursor.
Definition: cursor.hxx:142
static constexpr difference_type next() noexcept
Special value: read one row only.
Definition: cursor.hxx:116
static constexpr difference_type all() noexcept
Special value: read until end.
Definition: cursor.hxx:108
static constexpr difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:121
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
static constexpr difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.hxx:129
Reference to a field in a result set.
Definition: field.hxx:35
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:425
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:279
icursorstream & get(result &res)
Read new value into given result object; same as operator >>.
Definition: cursor.hxx:341
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result&).
Definition: cursor.hxx:355
Definition: icursor_iterator-icursorstream.hxx:6
Cursor with SQL positioning semantics.
Definition: sql_cursor.hxx:32
Result set containing data returned by a query or command.
Definition: result.hxx:73
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:169
constexpr std::string const & name() const noexcept
Return this cursor's name.
Definition: cursor.hxx:239
void close() noexcept
Close this cursor.
Definition: cursor.hxx:209
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:232
stateless_cursor(transaction_base &tx, std::string_view query, std::string_view cname, bool hold)
Create cursor.
Definition: cursor.hxx:183
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:215
stateless_cursor(transaction_base &tx, std::string_view adopted_cursor)
Adopt an existing scrolling SQL cursor.
Definition: cursor.hxx:196
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:150
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:27
int result_difference_type
Difference between result sizes.
Definition: types.hxx:31
int result_size_type
Number of rows in a result set.
Definition: types.hxx:28