#include <cursor.hxx>
Inheritance diagram for pqxx::cursor_base:
Public Types | |
typedef result::size_type | size_type |
typedef result::difference_type | difference_type |
enum | accesspolicy { forward_only, random_access } |
Cursor access-pattern policy. More... | |
enum | updatepolicy { read_only, update } |
Cursor update policy. More... | |
enum | ownershippolicy { owned, loose } |
Cursor destruction policy. More... | |
Public Member Functions | |
virtual | ~cursor_base () throw () |
operator void * () const | |
Does it make sense to try reading from this cursor again? | |
bool | operator! () const |
Is this cursor finished? | |
const PGSTD::string & | name () const throw () |
Name of underlying SQL cursor. | |
virtual result | fetch (difference_type) |
Fetch up to given number of rows of data. | |
virtual result | fetch (difference_type, difference_type &) |
Fetch result, but also return the number of rows of actual displacement. | |
virtual difference_type | move (difference_type) |
Move cursor by given number of rows, returning number of data rows skipped. | |
virtual difference_type | move (difference_type, difference_type &) |
Move cursor, but also return actual displacement in output parameter. | |
void | close () throw () |
Static Public Member Functions | |
Special movement distances | |
static difference_type | all () throw () |
Special value: read until end. | |
static difference_type | next () throw () |
Special value: read one row only. | |
static difference_type | prior () throw () |
Special value: read backwards, one row only. | |
static difference_type | backward_all () throw () |
Special value: read backwards from current position back to origin. | |
Protected Member Functions | |
cursor_base (transaction_base *, const PGSTD::string &Name, bool embellish_name=true) | |
void | declare (const PGSTD::string &query, accesspolicy, updatepolicy, ownershippolicy, bool hold) |
void | adopt (ownershippolicy) |
template<accesspolicy A> | |
void | check_displacement (difference_type) const |
Static Protected Member Functions | |
static PGSTD::string | stridestring (difference_type) |
Protected Attributes | |
transaction_base * | m_context |
bool | m_done |
Classes | |
struct | cachedquery |
In C++ terms, fetches are always done in pre-increment or pre-decrement fashion--i.e. the result does not include the row the cursor is on at the beginning of the fetch, and the cursor ends up being positioned on the last row in the result.
There are singular positions akin to end()
at both the beginning and the end of the cursor's range of movement, although these fit in so naturally with the semantics that one rarely notices them. The cursor begins at the first of these, but any fetch in the forward direction will move the cursor off this position and onto the first row before returning anything.
|
Reimplemented in pqxx::absolute_cursor< ACCESS, UPDATE >. |
|
Reimplemented in pqxx::absolute_cursor< ACCESS, UPDATE >. |
|
Cursor access-pattern policy. Allowing a cursor to move forward only can result in better performance, so use this access policy whenever possible. |
|
Cursor destruction policy. The normal thing to do is to make a cursor object the owner of the SQL cursor it represents. There may be cases, however, where a cursor needs to persist beyond the end of the current transaction (and thus also beyond the lifetime of the cursor object that created it!), where it can be "adopted" into a new cursor object. See the basic_cursor documentation for an explanation of cursor adoption. If a cursor is created with "loose" ownership policy, the object representing the underlying SQL cursor will not take the latter with it when its own lifetime ends, nor will its originating transaction.
|
|
Cursor update policy.
|
|
|
|
|
|
|
|
Special value: read until end.
|
|
Special value: read backwards from current position back to origin.
|
|
|
|
|
|
|
|
Fetch result, but also return the number of rows of actual displacement. The relationship between actual displacement and result size gets tricky at the edges of the cursor's range of movement. As an example, consider a fresh cursor that's been moved forward by 2 rows from its starting position; we can move it backwards from that position by 1 row and get a result set of 1 row, ending up on the first actual row of data. If instead we move it backwards by 2 or more rows, we end up back at the starting position--but the result is still only 1 row wide! The output parameter compensates for this, returning true displacement (which also signed, so it includes direction). |
|
Fetch up to given number of rows of data.
|
|
Move cursor, but also return actual displacement in output parameter.
As with the |
|
Move cursor by given number of rows, returning number of data rows skipped. The number of data rows skipped is equal to the number of rows of data that would have been returned if this were a fetch instead of a move command.
|
|
Name of underlying SQL cursor.
|
|
Special value: read one row only.
|
|
Does it make sense to try reading from this cursor again?
|
|
Is this cursor finished? The logical negation of the converstion-to-pointer operator.
|
|
Special value: read backwards, one row only.
|
|
|
|
|
|
|