16 #include "pqxx/compiler-public.hxx" 17 #include "pqxx/compiler-internal-pre.hxx" 22 #include "pqxx/result.hxx" 23 #include "pqxx/transaction_base.hxx" 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> 160 template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
170 const std::string &query,
171 const std::string &cname,
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;
230 class icursor_iterator_icursorstream;
231 class icursorstream_icursor_iterator;
272 const std::string &query,
273 const std::string &basename,
307 operator bool() const noexcept {
return not m_done; }
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 &);
436 #include "pqxx/compiler-internal-post.hxx" bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
const std::string & name() const noexcept
Name of underlying SQL cursor.
Definition: cursor.hxx:135
istream_type::difference_type difference_type
Definition: cursor.hxx:397
void close() noexcept
Definition: cursor.hxx:187
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:388
istream_type::size_type size_type
Definition: cursor.hxx:396
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
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
Result set containing data returned by a query or command.
Definition: result.hxx:69
Common definitions for cursor types.
Definition: cursor.hxx:40
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:139
const std::string & name() const noexcept
Definition: cursor.hxx:216
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:136
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:252
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
const std::string m_name
Definition: cursor.hxx:143
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
Cursor can move back and forth.
Definition: cursor.hxx:55
result_size_type size_type
Definition: cursor.hxx:43
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:161
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
Reference to a field in a result set.
Definition: field.hxx:49
result_difference_type difference_type
Definition: result.hxx:73
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
result_size_type size_type
Definition: cursor.hxx:164
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:89
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:50
Cursor can move forward only.
Definition: cursor.hxx:53
result_difference_type difference_type
Definition: cursor.hxx:44
cursor_base::size_type size_type
Definition: cursor.hxx:255
result_difference_type difference_type
Definition: cursor.hxx:165
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
difference_type stride() const noexcept
Definition: cursor.hxx:338
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
updatepolicy
Cursor update policy.
Definition: cursor.hxx:62
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
const result * operator->() const
Definition: cursor.hxx:405