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);
479 difference_type m_stride;
480 difference_type m_realpos, m_reqpos;
516 public PGSTD::iterator<PGSTD::input_iterator_tag,
518 cursor_base::size_type,
532 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" Result set containing data returned by a query or command.
Definition: result.hxx:81
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
Reference to a field in a result set.
Definition: field.hxx:43
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:101
istream_type::size_type size_type
Definition: cursor.hxx:524
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:336
const result & empty_result() const
Return zero-row result for this cursor.
Definition: cursor.hxx:237
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:62
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:290
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:545
cursor_base::size_type size_type
Definition: cursor.hxx:384
static difference_type backward_all()
Special value: read backwards from current position back to origin.
Definition: cursor.hxx:167
difference_type pos() const
Current position, or -1 for unknown.
Definition: cursor.hxx:225
difference_type stride() const
Definition: cursor.hxx:465
void close()
Definition: cursor.hxx:316
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:547
difference_type endpos() const
End position, or -1 for unknown.
Definition: cursor.hxx:234
const std::string & name() const
Name of underlying SQL cursor.
Definition: cursor.hxx:139
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:451
bool operator!=(const icursor_iterator &rhs) const
Definition: cursor.hxx:540
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:322
istream_type::difference_type difference_type
Definition: cursor.hxx:525
cursor_base::difference_type difference_type
Definition: cursor.hxx:385
static difference_type all()
Special value: read until end.
Definition: cursor.hxx:158
difference_type move(difference_type rows)
Definition: cursor.hxx:215
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:543
result::size_type size_type
Definition: cursor.hxx:55
static difference_type prior()
Special value: read backwards, one row only.
Definition: cursor.hxx:125
updatepolicy
Cursor update policy.
Definition: cursor.hxx:74
result stateless_cursor_retrieve(sql_cursor &, result::difference_type size, result::difference_type begin_pos, result::difference_type end_pos)
Definition: cursor.cxx:319
result::size_type size_type
Definition: cursor.hxx:293
result::difference_type difference_type
Definition: cursor.hxx:56
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:307
Cursor can be used to read data but not to write.
Definition: cursor.hxx:77
~sql_cursor()
Definition: cursor.hxx:209
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:515
Cursor with SQL positioning semantics.
Definition: cursor.hxx:194
result::difference_type difference_type
Definition: cursor.hxx:294
const std::string m_name
Definition: cursor.hxx:146
const std::string & name() const
Definition: cursor.hxx:345
result fetch(difference_type rows)
Definition: cursor.hxx:212
signed long difference_type
Definition: result.hxx:89
Cursor can move forward only.
Definition: cursor.hxx:65
icursorstream istream_type
Definition: cursor.hxx:523
unsigned long size_type
Definition: result.hxx:88
const result * operator->() const
Definition: cursor.hxx:533
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
Definition: transaction_base.hxx:133
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:297
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:104
result::size_type obtain_stateless_cursor_size(sql_cursor &)
Definition: cursor.cxx:312
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:381
Common definitions for cursor types.
Definition: cursor.hxx:52