Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

pqxx::CachedResult Class Reference

#include <cachedresult.h>

List of all members.

Public Types

typedef Result::size_type size_type
typedef size_type blocknum
typedef Result::Tuple Tuple

Public Methods

 CachedResult (pqxx::TransactionItf &, const char Query[], PGSTD::string BaseName="query", size_type Granularity=100)
const Tuple operator[] (size_type i) const
const Tuple at (size_type i) const
size_type size () const
 Number of rows in result set.

bool empty () const
 Is the result set empty, i.e. does it contain no rows? May fetch 1 block.

void clear ()
 Drop all data in internal cache, freeing up memory.


Detailed Description

Cached result set. Chunks of result data are transparently fetched on-demand and stored in an internal cache for reuse. Functionality is similar to that of Result, with certain restrictions and different performance characteristics. A CachedResult must live in the context of a transaction, so that it can fetch further rows as they are needed.

The class uses a Cursor internally to fetch results. Data are not fetched row-by-row, but in chunks of configurable size. For internal computational reasons, these chunks (called "blocks" here) must be at least 2 rows large.


Member Typedef Documentation

typedef size_type pqxx::CachedResult::blocknum
 

typedef Result::size_type pqxx::CachedResult::size_type
 

typedef Result::Tuple pqxx::CachedResult::Tuple
 


Constructor & Destructor Documentation

pqxx::CachedResult::CachedResult pqxx::TransactionItf  ,
const char    Query[],
PGSTD::string    BaseName = "query",
size_type    Granularity = 100
[explicit]
 

Perform query and transparently fetch and cache resulting data. Granularity determines how large the blocks of data used internally will be; must be at least 2.


Member Function Documentation

const Tuple pqxx::CachedResult::at size_type    i const
 

void pqxx::CachedResult::clear  
 

Drop all data in internal cache, freeing up memory.

bool pqxx::CachedResult::empty   const
 

Is the result set empty, i.e. does it contain no rows? May fetch 1 block.

const Tuple pqxx::CachedResult::operator[] size_type    i const
 

size_type pqxx::CachedResult::size   const
 

Number of rows in result set.

Figuring out the size of the result set for the first time may take a lot of time and network traffic, as the CachedResult's internal cursor scans back and forth in search of the set's last row. Some 30 blocks of data may be fetched in the process.


The documentation for this class was generated from the following files:
Generated on Tue Dec 3 01:37:35 2002 for libpqxx by doxygen1.3-rc1