libpqxx  v4.0-1
C++ library for PostgreSQL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pqxx::stateless_cursor< up, op > Class Template Reference

"Stateless cursor" class: easy API for retrieving parts of result sets More...

#include <cursor.hxx>

Collaboration diagram for pqxx::stateless_cursor< up, op >:

Public Types

typedef result::difference_type difference_type
 
typedef result::size_type size_type
 

Public Member Functions

 stateless_cursor (transaction_base &trans, const PGSTD::string &query, const PGSTD::string &cname, bool hold)
 Create cursor. More...
 
 stateless_cursor (transaction_base &trans, const PGSTD::string adopted_cursor)
 Adopt existing scrolling SQL cursor. More...
 
void close () throw ()
 
const PGSTD::string & name () const throw ()
 
result retrieve (difference_type begin_pos, difference_type end_pos)
 Retrieve rows from begin_pos (inclusive) to end_pos (exclusive) More...
 
size_type size ()
 Number of rows in cursor's result set. More...
 

Private Attributes

internal::sql_cursor m_cur
 

Detailed Description

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
class pqxx::stateless_cursor< up, op >

"Stateless cursor" class: easy API for retrieving parts of result sets

This is a front-end for SQL cursors, but with a more C++-like API.

Actually, stateless_cursor feels entirely different from SQL cursors. You don't keep track of positions, fetches, and moves; you just say which rows you want. See the retrieve() member function.

Member Typedef Documentation

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
typedef result::difference_type pqxx::stateless_cursor< up, op >::difference_type
template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
typedef result::size_type pqxx::stateless_cursor< up, op >::size_type

Constructor & Destructor Documentation

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
pqxx::stateless_cursor< up, op >::stateless_cursor ( transaction_base trans,
const PGSTD::string &  query,
const PGSTD::string &  cname,
bool  hold 
)
inline

Create cursor.

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
pqxx::stateless_cursor< up, op >::stateless_cursor ( transaction_base trans,
const PGSTD::string  adopted_cursor 
)
inline

Adopt existing scrolling SQL cursor.

References pqxx::cursor_base::backward_all().

Here is the call graph for this function:

Member Function Documentation

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
void pqxx::stateless_cursor< up, op >::close ( ) throw ()
inline
template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
const PGSTD::string& pqxx::stateless_cursor< up, op >::name ( ) const throw ()
inline
template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
result pqxx::stateless_cursor< up, op >::retrieve ( difference_type  begin_pos,
difference_type  end_pos 
)
inline

Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)

Rows are numbered starting from 0 to size()-1.

Parameters
begin_posFirst row to retrieve. May be one row beyond the end of the result set, to avoid errors for empty result sets. Otherwise, must be a valid row number in the result set.
end_posRow up to which to fetch. Rows are returned ordered from begin_pos to end_pos, i.e. in ascending order if begin_pos < end_pos but in descending order if begin_pos > end_pos. The end_pos may be arbitrarily inside or outside the result set; only existing rows are included in the result.

References pqxx::internal::stateless_cursor_retrieve().

Here is the call graph for this function:

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
size_type pqxx::stateless_cursor< up, op >::size ( )
inline

Number of rows in cursor's result set.

Note
This function is not const; it may need to scroll to find the size of the result set.

References pqxx::internal::obtain_stateless_cursor_size().

Here is the call graph for this function:

Member Data Documentation

template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
internal::sql_cursor pqxx::stateless_cursor< up, op >::m_cur
private

The documentation for this class was generated from the following file: