22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
28 #include "pqxx/result"
29 #include "pqxx/transaction_base"
114 static difference_type all() PQXX_NOEXCEPT;
126 static difference_type backward_all() PQXX_NOEXCEPT;
136 const std::
string &name() const PQXX_NOEXCEPT {
return m_name; }
140 const std::string &Name,
141 bool embellish_name=
true);
157 return std::numeric_limits<int>::max()-1;
162 return std::numeric_limits<int>::min()+1;
187 const std::string &query,
188 const std::string &cname,
195 const std::string &cname,
200 result fetch(difference_type rows, difference_type &displacement);
203 difference_type move(difference_type rows, difference_type &displacement);
228 void close() PQXX_NOEXCEPT;
231 difference_type adjust(difference_type hoped, difference_type actual);
232 static std::
string stridestring(difference_type);
242 result m_cached_current_row;
254 difference_type m_pos;
257 difference_type m_endpos;
264 result::difference_type size,
265 result::difference_type begin_pos,
266 result::difference_type end_pos);
287 transaction_base &trans,
288 const std::string &query,
289 const std::string &cname,
291 m_cur(trans, query, cname,
cursor_base::random_access, up, op, hold)
297 transaction_base &trans,
298 const std::string adopted_cursor) :
299 m_cur(trans, adopted_cursor, op)
305 void close() PQXX_NOEXCEPT { m_cur.close(); }
334 const std::string &
name() const PQXX_NOEXCEPT {
return m_cur.name(); }
341 class icursor_iterator;
348 class icursor_iterator_icursorstream;
349 class icursorstream_icursor_iterator;
389 const std::string &query,
390 const std::string &basename,
423 operator bool() const PQXX_NOEXCEPT {
return !m_done; }
453 void set_stride(difference_type stride);
459 friend class internal::gate::icursorstream_icursor_iterator;
466 internal::sql_cursor m_cur;
468 difference_type m_stride;
469 difference_type m_realpos, m_reqpos;
505 public std::iterator<std::input_iterator_tag,
521 const result &operator*()
const { refresh();
return m_here; }
522 const result *
operator->()
const { refresh();
return &m_here; }
530 {
return !operator==(rhs); }
533 {
return rhs < *
this; }
535 {
return !(*
this > rhs); }
537 {
return !(*
this < rhs); }
540 void refresh()
const;
542 friend class internal::gate::icursor_iterator_icursorstream;
543 difference_type pos() const PQXX_NOEXCEPT {
return m_pos; }
544 void fill(
const result &);
548 difference_type m_pos;
555 #include "pqxx/compiler-internal-post.hxx"
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:149
void close() PQXX_NOEXCEPT
Definition: cursor.hxx:305
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:504
updatepolicy
Cursor update policy.
Definition: cursor.hxx:71
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:296
unsigned long size_type
Definition: result.hxx:85
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:534
Cursor can be used to read data but not to write.
Definition: cursor.hxx:74
cursor_base::size_type size_type
Definition: cursor.hxx:373
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:325
difference_type endpos() const PQXX_NOEXCEPT
End position, or -1 for unknown.
Definition: cursor.hxx:223
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:59
Reference to a field in a result set.
Definition: field.hxx:51
result fetch(difference_type rows)
Definition: cursor.hxx:201
result::size_type size_type
Definition: cursor.hxx:52
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:532
difference_type pos() const PQXX_NOEXCEPT
Current position, or -1 for unknown.
Definition: cursor.hxx:214
const result & empty_result() const PQXX_NOEXCEPT
Return zero-row result for this cursor.
Definition: cursor.hxx:226
difference_type move(difference_type rows)
Definition: cursor.hxx:204
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:98
istream_type::difference_type difference_type
Definition: cursor.hxx:514
signed long difference_type
Definition: result.hxx:86
difference_type stride() const PQXX_NOEXCEPT
Definition: cursor.hxx:454
result::size_type size_type
Definition: cursor.hxx:282
Cursor with SQL positioning semantics.
Definition: cursor.hxx:183
result::difference_type difference_type
Definition: cursor.hxx:53
Cursor can move forward only.
Definition: cursor.hxx:62
~sql_cursor() PQXX_NOEXCEPT
Definition: cursor.hxx:198
cursor_base::difference_type difference_type
Definition: cursor.hxx:374
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:311
const std::string m_name
Definition: cursor.hxx:143
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:536
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:101
const result * operator->() const
Definition: cursor.hxx:522
static difference_type backward_all() PQXX_NOEXCEPT
Special value: read backwards from current position back to origin.
Definition: cursor.hxx:160
result::size_type obtain_stateless_cursor_size(sql_cursor &)
Definition: cursor.cxx:278
result::difference_type difference_type
Definition: cursor.hxx:283
static difference_type all() PQXX_NOEXCEPT
Special value: read until end.
Definition: cursor.hxx:155
const std::string & name() const PQXX_NOEXCEPT
Definition: cursor.hxx:334
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:370
icursorstream istream_type
Definition: cursor.hxx:512
Common definitions for cursor types.
Definition: cursor.hxx:49
result stateless_cursor_retrieve(sql_cursor &, result::difference_type size, result::difference_type begin_pos, result::difference_type end_pos)
Definition: cursor.cxx:285
Result set containing data returned by a query or command.
Definition: result.hxx:78
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:286
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:440
static difference_type prior() PQXX_NOEXCEPT
Special value: read backwards, one row only.
Definition: cursor.hxx:122
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:279
Definition: transaction_base.hxx:133
istream_type::size_type size_type
Definition: cursor.hxx:513