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,
211 result fetch(difference_type rows, difference_type &displacement);
214 difference_type move(difference_type rows, difference_type &displacement);
239 void close() throw ();
242 difference_type adjust(difference_type hoped, difference_type actual);
243 static PGSTD::
string stridestring(difference_type);
253 result m_cached_current_row;
265 difference_type m_pos;
268 difference_type m_endpos;
275 result::difference_type size,
276 result::difference_type begin_pos,
277 result::difference_type end_pos);
298 transaction_base &trans,
299 const PGSTD::string &query,
300 const PGSTD::string &cname,
302 m_cur(trans, query, cname,
cursor_base::random_access, up, op, hold)
308 transaction_base &trans,
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(); }
352 class icursor_iterator;
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"
cursor_base::difference_type difference_type
Definition: cursor.hxx:385
difference_type move(difference_type rows)
Definition: cursor.hxx:215
const result * operator->() const
Definition: cursor.hxx:533
cursor_base::size_type size_type
Definition: cursor.hxx:384
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:451
result stateless_cursor_retrieve(sql_cursor &, result::difference_type size, result::difference_type begin_pos, result::difference_type end_pos)
Definition: cursor.cxx:319
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:322
icursorstream istream_type
Definition: cursor.hxx:523
Cursor with SQL positioning semantics.
Definition: cursor.hxx:194
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:545
difference_type pos() const
Current position, or -1 for unknown.
Definition: cursor.hxx:225
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:381
const result & empty_result() const
Return zero-row result for this cursor.
Definition: cursor.hxx:237
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:297
result::difference_type difference_type
Definition: cursor.hxx:56
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:336
void close()
Definition: cursor.hxx:316
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
Reference to a field in a result set.
Definition: field.hxx:43
signed long difference_type
Definition: result.hxx:89
const std::string & name() const
Definition: cursor.hxx:345
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:101
static difference_type prior()
Special value: read backwards, one row only.
Definition: cursor.hxx:125
const std::string m_name
Definition: cursor.hxx:146
result::size_type obtain_stateless_cursor_size(sql_cursor &)
Definition: cursor.cxx:312
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:62
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:290
istream_type::size_type size_type
Definition: cursor.hxx:524
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
static difference_type backward_all()
Special value: read backwards from current position back to origin.
Definition: cursor.hxx:167
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:515
result::difference_type difference_type
Definition: cursor.hxx:294
static difference_type all()
Special value: read until end.
Definition: cursor.hxx:158
Cursor can move forward only.
Definition: cursor.hxx:65
difference_type stride() const
Definition: cursor.hxx:465
result::size_type size_type
Definition: cursor.hxx:55
difference_type endpos() const
End position, or -1 for unknown.
Definition: cursor.hxx:234
istream_type::difference_type difference_type
Definition: cursor.hxx:525
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:104
result fetch(difference_type rows)
Definition: cursor.hxx:212
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:547
Common definitions for cursor types.
Definition: cursor.hxx:52
unsigned long size_type
Definition: result.hxx:88
result::size_type size_type
Definition: cursor.hxx:293
updatepolicy
Cursor update policy.
Definition: cursor.hxx:74
~sql_cursor()
Definition: cursor.hxx:209
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:543
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
Result set containing data returned by a query or command.
Definition: result.hxx:81
Definition: transaction_base.hxx:133