#include <cachedresult.h>
Public Types | |
typedef result::size_type | size_type |
typedef size_type | blocknum |
typedef result::tuple | tuple |
Tuple type. Currently borrowed from result, but may change in the future. | |
typedef tuple | Tuple |
Public Member Functions | |
template<typename TRANSACTION> | |
cachedresult (TRANSACTION &T, const char Query[], const PGSTD::string &BaseName="query", size_type Granularity=100) | |
const tuple | operator[] (size_type i) const |
Access a tuple. Invalid index yields undefined behaviour. | |
const tuple | at (size_type i) const |
Access a tuple. Throws exception if index is out of range. | |
size_type | size () const |
Number of rows in result set. First call may be slow. | |
bool | empty () const |
Is the result set empty, i.e. does it contain no rows? May fetch 1 block. |
Tuple type. Currently borrowed from result, but may change in the future.
typedef tuple pqxx::cachedresult::Tuple |
pqxx::cachedresult::cachedresult | ( | TRANSACTION & | T, | |
const char | Query[], | |||
const PGSTD::string & | BaseName = "query" , |
|||
size_type | Granularity = 100 | |||
) | [explicit] |
Perform query and transparently fetch and cache resulting data.
T | is the transaction context in which the cachedresult lives. This will be used whenever data is fetched. Must have isolation level "serializable," otherwise a build error will be generated for the symbol error_permitted_isolation_level. | |
Query | is the SQL query that yields the desired result set. | |
BaseName | gives the initial part of the name for this cachedresult and the Cursor it uses to obtain its results. | |
Granularity | determines how large the blocks of data used internally will be; must be at least 2. |
Access a tuple. Invalid index yields undefined behaviour.
Caveat: the tuple contains a reference to a result that may be destroyed by any other operation on the cachedresult, even if its constness is preserved. Therefore only use the returned tuple as a temporary, and do not try to copy-construct it, or keep references or pointers to it.
i | the number of the tuple to be accessed. |
Access a tuple. Throws exception if index is out of range.
If the given index is not the index of an existing row, an out_of_range error will be thrown.
Caveat: the tuple contains a reference to a result that may be destroyed by any other operation on the cachedresult, even if its constness is preserved. Therefore only use the returned tuple as a temporary, and do not try to copy-construct it, or keep references or pointers to it.
i | the number of the tuple to be accessed. |
pqxx::cachedresult::size_type pqxx::cachedresult::size | ( | ) | const |
Number of rows in result set. First call may be slow.
bool pqxx::cachedresult::empty | ( | ) | const |
Is the result set empty, i.e. does it contain no rows? May fetch 1 block.