22 #include "pqxx/compiler-public.hxx" 23 #include "pqxx/compiler-internal-pre.hxx" 27 #ifdef PQXX_HAVE_LIMITS 31 #include "pqxx/result" 32 #include "pqxx/transaction_base" 117 static difference_type all() throw ();
121 static difference_type next() throw () {
return 1; }
125 static difference_type
prior() throw () {
return -1; }
129 static difference_type backward_all()
throw ();
139 const PGSTD::string &
name()
const throw () {
return m_name; }
143 const PGSTD::string &Name,
144 bool embellish_name=
true);
160 #ifdef PQXX_HAVE_LIMITS 161 return PGSTD::numeric_limits<int>::max()-1;
169 #ifdef PQXX_HAVE_LIMITS 170 return PGSTD::numeric_limits<int>::min()+1;
198 const PGSTD::string &query,
199 const PGSTD::string &cname,
206 const PGSTD::string &cname,
239 void close()
throw ();
253 result m_cached_current_row;
289 template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
299 const PGSTD::string &query,
300 const PGSTD::string &cname,
302 m_cur(trans, query, cname,
cursor_base::random_access, up, op, hold)
309 const PGSTD::string adopted_cursor) :
310 m_cur(trans, adopted_cursor, op)
316 void close() throw () { m_cur.close(); }
345 const PGSTD::string &
name()
const throw () {
return m_cur.name(); }
359 class icursor_iterator_icursorstream;
360 class icursorstream_icursor_iterator;
400 const PGSTD::string &query,
401 const PGSTD::string &basename,
402 difference_type sstride=1);
431 difference_type sstride=1,
434 operator bool()
const throw () {
return !m_done; }
464 void set_stride(difference_type stride);
465 difference_type
stride()
const throw () {
return m_stride; }
470 friend class internal::gate::icursorstream_icursor_iterator;
471 size_type forward(size_type n=1);
475 void service_iterators(difference_type);
477 internal::sql_cursor m_cur;
479 difference_type m_stride;
480 difference_type m_realpos, m_reqpos;
516 public PGSTD::iterator<PGSTD::input_iterator_tag,
532 const result &operator*()
const { refresh();
return m_here; }
533 const result *
operator->()
const { refresh();
return &m_here; }
541 {
return !operator==(rhs); }
544 {
return rhs < *
this; }
546 {
return !(*
this > rhs); }
548 {
return !(*
this < rhs); }
551 void refresh()
const;
553 friend class internal::gate::icursor_iterator_icursorstream;
554 difference_type pos()
const throw () {
return m_pos; }
555 void fill(
const result &);
559 difference_type m_pos;
566 #include "pqxx/compiler-internal-post.hxx" istream_type::size_type size_type
Definition: cursor.hxx:524
cursor_base::size_type size_type
Definition: cursor.hxx:384
const std::string & name() const
Definition: cursor.hxx:345
result stateless_cursor_retrieve(sql_cursor &, result::difference_type size, result::difference_type begin_pos, result::difference_type end_pos)
Definition: cursor.cxx:319
static difference_type all()
Special value: read until end.
Definition: cursor.hxx:158
const result & empty_result() const
Return zero-row result for this cursor.
Definition: cursor.hxx:237
istream_type::difference_type difference_type
Definition: cursor.hxx:525
Reference to a field in a result set.
Definition: field.hxx:43
result::size_type size_type
Definition: cursor.hxx:293
static difference_type prior()
Special value: read backwards, one row only.
Definition: cursor.hxx:125
result::size_type size_type
Definition: cursor.hxx:55
signed long difference_type
Definition: result.hxx:89
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:322
difference_type pos() const
Current position, or -1 for unknown.
Definition: cursor.hxx:225
Result set containing data returned by a query or command.
Definition: result.hxx:81
const std::string & name() const
Name of underlying SQL cursor.
Definition: cursor.hxx:139
result::difference_type difference_type
Definition: cursor.hxx:294
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:451
updatepolicy
Cursor update policy.
Definition: cursor.hxx:74
Definition: transaction_base.hxx:133
const std::string m_name
Definition: cursor.hxx:146
Cursor with SQL positioning semantics.
Definition: cursor.hxx:194
result::size_type obtain_stateless_cursor_size(sql_cursor &)
Definition: cursor.cxx:312
~sql_cursor()
Definition: cursor.hxx:209
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:543
const result * operator->() const
Definition: cursor.hxx:533
unsigned long size_type
Definition: result.hxx:88
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:547
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:381
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:297
Common definitions for cursor types.
Definition: cursor.hxx:52
difference_type stride() const
Definition: cursor.hxx:465
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
void close()
Definition: cursor.hxx:316
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:336
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:101
result fetch(difference_type rows)
Definition: cursor.hxx:212
difference_type endpos() const
End position, or -1 for unknown.
Definition: cursor.hxx:234
icursorstream istream_type
Definition: cursor.hxx:523
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:515
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:307
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:290
difference_type move(difference_type rows)
Definition: cursor.hxx:215
Cursor can move forward only.
Definition: cursor.hxx:65
Cursor can be used to read data but not to write.
Definition: cursor.hxx:77
result::difference_type difference_type
Definition: cursor.hxx:56
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:62
static difference_type backward_all()
Special value: read backwards from current position back to origin.
Definition: cursor.hxx:167
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:545
bool operator!=(const icursor_iterator &rhs) const
Definition: cursor.hxx:540
cursor_base::difference_type difference_type
Definition: cursor.hxx:385
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:104