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);
169 const std::string &query,
170 const std::string &cname,
178 const std::string &cname,
183 result fetch(difference_type rows, difference_type &displacement);
185 { difference_type d=0;
return fetch(rows, d); }
186 difference_type move(difference_type rows, difference_type &displacement);
187 difference_type
move(difference_type rows)
188 { difference_type d=0;
return move(rows, d); }
197 difference_type
pos() const noexcept {
return m_pos; }
206 difference_type
endpos() const noexcept {
return m_endpos; }
211 void close() noexcept;
214 difference_type adjust(difference_type hoped, difference_type actual);
215 static std::string stridestring(difference_type);
225 result m_cached_current_row;
237 difference_type m_pos;
240 difference_type m_endpos = -1;
261 template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
271 const std::string &query,
272 const std::string &cname,
274 m_cur(trans, query, cname,
cursor_base::random_access, up, op, hold)
281 const std::string adopted_cursor) :
282 m_cur(trans, adopted_cursor, op)
288 void close() noexcept { m_cur.close(); }
317 const std::string &
name() const noexcept {
return m_cur.name(); }
331 class icursor_iterator_icursorstream;
332 class icursorstream_icursor_iterator;
373 const std::string &query,
374 const std::string &basename,
408 operator bool() const noexcept {
return !m_done; }
444 friend class internal::gate::icursorstream_icursor_iterator;
490 public std::iterator<std::input_iterator_tag,
492 cursor_base::size_type,
506 const
result &operator*()
const { refresh();
return m_here; }
515 {
return !operator==(rhs); }
518 {
return rhs < *
this; }
520 {
return !(*
this > rhs); }
522 {
return !(*
this < rhs); }
525 void refresh()
const;
527 friend class internal::gate::icursor_iterator_icursorstream;
529 void fill(
const result &);
539 #include "pqxx/compiler-internal-post.hxx" const result & empty_result() const noexcept
Return zero-row result for this cursor.
Definition: cursor.hxx:209
Result set containing data returned by a query or command.
Definition: result.hxx:65
istream_type::difference_type difference_type
Definition: cursor.hxx:499
~sql_cursor() noexcept
Definition: cursor.hxx:181
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
difference_type stride() const noexcept
Definition: cursor.hxx:439
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:89
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:489
cursor_base::size_type size_type
Definition: cursor.hxx:356
result_size_type obtain_stateless_cursor_size(sql_cursor &)
Definition: cursor.cxx:289
Cursor with SQL positioning semantics.
Definition: cursor.hxx:164
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:279
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:52
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:425
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:269
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:22
result stateless_cursor_retrieve(sql_cursor &, result::difference_type size, result::difference_type begin_pos, result::difference_type end_pos)
Definition: cursor.cxx:296
const result * operator->() const
Definition: cursor.hxx:507
istream_type::size_type size_type
Definition: cursor.hxx:498
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:130
difference_type move(difference_type rows)
Definition: cursor.hxx:187
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:514
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:353
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:308
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
result_difference_type difference_type
Definition: result.hxx:69
result_size_type size_type
Definition: cursor.hxx:43
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:521
result_size_type size_type
Definition: cursor.hxx:265
result_difference_type difference_type
Definition: cursor.hxx:266
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:262
result fetch(difference_type rows)
Definition: cursor.hxx:184
void close() noexcept
Definition: cursor.hxx:288
updatepolicy
Cursor update policy.
Definition: cursor.hxx:62
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:519
cursor_base::difference_type difference_type
Definition: cursor.hxx:357
Reference to a field in a result set.
Definition: field.hxx:48
const std::string m_name
Definition: cursor.hxx:143
result_difference_type difference_type
Definition: cursor.hxx:44
difference_type endpos() const noexcept
End position, or -1 for unknown.
Definition: cursor.hxx:206
difference_type pos() const noexcept
Current position, or -1 for unknown.
Definition: cursor.hxx:197
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:50
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:517
const std::string & name() const noexcept
Definition: cursor.hxx:317
const std::string & name() const noexcept
Name of underlying SQL cursor.
Definition: cursor.hxx:135
Cursor can move forward only.
Definition: cursor.hxx:53
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:294
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92