Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pqxx::absolute_cursor< ACCESS, UPDATE > Class Template Reference

Cursor that knows its position. More...

#include <cursor.hxx>

Inheritance diagram for pqxx::absolute_cursor< ACCESS, UPDATE >:

Inheritance graph
[legend]
Collaboration diagram for pqxx::absolute_cursor< ACCESS, UPDATE >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef cursor_base::size_type size_type
typedef cursor_base::difference_type difference_type

Public Member Functions

 absolute_cursor (transaction_base *t, const PGSTD::string &query, const PGSTD::string &cname)
 Create cursor based on given query.
virtual result fetch (difference_type n)
 Fetch a number of rows from cursor.
virtual difference_type move (difference_type n)
 Move cursor by given number of rows.
virtual difference_type move (difference_type d, difference_type &m)
 Move cursor, but also return actual displacement in output parameter.
virtual result fetch (difference_type d, difference_type &m)
 Fetch result, but also return the number of rows of actual displacement.
size_type pos () const throw ()
difference_type move_to (cursor_base::size_type)

Detailed Description

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
class pqxx::absolute_cursor< ACCESS, UPDATE >

Cursor that knows its position.


Member Typedef Documentation

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
typedef cursor_base::difference_type pqxx::absolute_cursor< ACCESS, UPDATE >::difference_type
 

Reimplemented from pqxx::cursor_base.

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
typedef cursor_base::size_type pqxx::absolute_cursor< ACCESS, UPDATE >::size_type
 

Reimplemented from pqxx::cursor_base.


Constructor & Destructor Documentation

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
pqxx::absolute_cursor< ACCESS, UPDATE >::absolute_cursor transaction_base t,
const PGSTD::string &  query,
const PGSTD::string &  cname
 

Create cursor based on given query.

Parameters:
t transaction this cursor is to live in
query SQL query whose results this cursor will iterate
cname name for this cursor, which will be changed to make it unique
Warning:
If the transaction being used is a nontransaction, a "WITH HOLD" cursor will be created. Not all backends versions support this.


Member Function Documentation

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
virtual result pqxx::absolute_cursor< ACCESS, UPDATE >::fetch difference_type  d,
difference_type m
[virtual]
 

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).

Reimplemented from pqxx::basic_cursor< ACCESS, UPDATE >.

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
virtual result pqxx::absolute_cursor< ACCESS, UPDATE >::fetch difference_type  n  )  [virtual]
 

Fetch a number of rows from cursor.

This function can be used to fetch a given number of rows (by passing the desired number of rows as an argument), or all remaining rows (by passing cursor_base::all()), or fetch a given number of rows backwards from the current position (by passing the negative of the desired number), or all rows remaining behind the current position (by using cursor_base::backwards_all()).

This function behaves slightly differently from the SQL FETCH command. Most notably, fetching zero rows does not move the cursor, and returns an empty result.

Warning:
When zero rows are fetched, the returned result may not contain any metadata such as the number of columns and their names.
Parameters:
n number of rows to fetch
Returns:
a result set containing at most n rows of data

Reimplemented from pqxx::basic_cursor< ACCESS, UPDATE >.

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
virtual difference_type pqxx::absolute_cursor< ACCESS, UPDATE >::move difference_type  d,
difference_type m
[virtual]
 

Move cursor, but also return actual displacement in output parameter.

As with the

functions, the actual displacement may differ from the number of data rows skipped by the move.

Reimplemented from pqxx::basic_cursor< ACCESS, UPDATE >.

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
virtual difference_type pqxx::absolute_cursor< ACCESS, UPDATE >::move difference_type  n  )  [virtual]
 

Move cursor by given number of rows.

Parameters:
n number of rows to move
Returns:
number of rows actually moved (which cannot exceed n)

Reimplemented from pqxx::basic_cursor< ACCESS, UPDATE >.

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
difference_type pqxx::absolute_cursor< ACCESS, UPDATE >::move_to cursor_base::size_type   ) 
 

template<cursor_base::accesspolicy ACCESS, cursor_base::updatepolicy UPDATE>
size_type pqxx::absolute_cursor< ACCESS, UPDATE >::pos  )  const throw ()
 


The documentation for this class was generated from the following file:
Generated on Mon Oct 3 20:29:04 2005 for libpqxx by  doxygen 1.4.2