16#include "pqxx/compiler-public.hxx"
17#include "pqxx/compiler-internal-pre.hxx"
22#include "pqxx/result.hxx"
23#include "pqxx/transaction_base.hxx"
125 static difference_type backward_all() noexcept;
135 const
std::
string &name() const noexcept {
return m_name; }
140 const std::string &Name,
141 bool embellish_name=
true);
148#include <pqxx/internal/sql_cursor.hxx>
160template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
170 const std::string &query,
171 const std::string &cname,
173 m_cur{trans, query, cname,
cursor_base::random_access, up, op, hold}
180 const std::string adopted_cursor) :
181 m_cur{trans, adopted_cursor, op}
187 void close() noexcept { m_cur.close(); }
209 return internal::stateless_cursor_retrieve(
216 const std::string &
name() const noexcept {
return m_cur.name(); }
219 internal::sql_cursor m_cur;
223class icursor_iterator;
230class icursor_iterator_icursorstream;
231class icursorstream_icursor_iterator;
272 const std::string &query,
273 const std::string &basename,
307 operator bool() const noexcept {
return not m_done; }
337 void set_stride(difference_type stride);
343 friend class internal::gate::icursorstream_icursor_iterator;
350 internal::sql_cursor m_cur;
404 const
result &operator*()
const { refresh();
return m_here; }
413 {
return not operator==(rhs); }
416 {
return rhs < *
this; }
418 {
return not (*
this > rhs); }
420 {
return not (*
this < rhs); }
423 void refresh()
const;
425 friend class internal::gate::icursor_iterator_icursorstream;
427 void fill(
const result &);
431 difference_type m_pos;
436#include "pqxx/compiler-internal-post.hxx"
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
Common definitions for cursor types.
Definition: cursor.hxx:41
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
cursor_base(const cursor_base &)=delete
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:51
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
result_size_type size_type
Definition: cursor.hxx:43
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:90
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
const std::string m_name
Definition: cursor.hxx:143
updatepolicy
Cursor update policy.
Definition: cursor.hxx:63
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
cursor_base & operator=(const cursor_base &)=delete
result_difference_type difference_type
Definition: cursor.hxx:44
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:162
const std::string & name() const noexcept
Definition: cursor.hxx:216
void close() noexcept
Definition: cursor.hxx:187
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
result_size_type size_type
Definition: cursor.hxx:164
result_difference_type difference_type
Definition: cursor.hxx:165
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:253
cursor_base::size_type size_type
Definition: cursor.hxx:255
icursorstream & get(result &res)
Read new value into given result object; same as operator >>
Definition: cursor.hxx:316
difference_type stride() const noexcept
Definition: cursor.hxx:338
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:389
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
istream_type::difference_type difference_type
Definition: cursor.hxx:397
const result * operator->() const
Definition: cursor.hxx:405
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
istream_type::size_type size_type
Definition: cursor.hxx:396
Reference to a field in a result set.
Definition: field.hxx:50
Result set containing data returned by a query or command.
Definition: result.hxx:70
result_difference_type difference_type
Definition: result.hxx:73
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138