# pqxx::tablereader Class Reference

Efficiently pull data directly out of a table. More...

`#include <tablereader.hxx>`

Inheritance diagram for pqxx::tablereader:

[legend]
List of all members.

## Public Member Functions

| tablereader (transaction_base &, const PGSTD::string &Name, const PGSTD::string &Null=PGSTD::string())
template<typename ITER>
| tablereader (transaction_base &, const PGSTD::string &Name, ITER begincolumns, ITER endcolumns)
| Read only the given sequence of columns.
template<typename ITER>
| tablereader (transaction_base &, const PGSTD::string &Name, ITER begincolumns, ITER endcolumns, const PGSTD::string &Null)
| ~tablereader () throw ()
template<typename TUPLE>
tablereader & | operator>> (TUPLE &)
| operator bool () const throw ()
bool | operator! () const throw ()
bool | get_raw_line (PGSTD::string &Line)
| Read a line of raw, unparsed table data.
template<typename TUPLE>
void | tokenize (PGSTD::string, TUPLE &) const
virtual void | complete ()
| Finish stream action, check for errors, and detach from transaction.

## Detailed Description

Efficiently pull data directly out of a table.

A tablereader provides efficient read access to a database table. This is not as flexible as a normal query using the result class however:

- Can only dump tables, not views or arbitrary queries
- Has no knowledge of metadata
- Is unable to reorder, rename, omit or enrich fields
- Does not support filtering of records

On the other hand, it can read rows of data and transform them into any container or container-like object that supports STL back-inserters. Since the tablereader has no knowledge of the types of data expected, it treats all fields as strings.

## Constructor & Destructor Documentation

pqxx::tablereader::tablereader | ( | transaction_base & | ,
|  | const PGSTD::string & | Name,
|  | const PGSTD::string & | Null = `PGSTD::string()` |
| ) |  |  |

template<typename ITER>

pqxx::tablereader::tablereader | ( | transaction_base & | ,
|  | const PGSTD::string & | Name,
|  | ITER | begincolumns,
|  | ITER | endcolumns |
| ) |  |  |

Read only the given sequence of columns.

Since:
  PostgreSQL backend 7.3

template<typename ITER>

pqxx::tablereader::tablereader | ( | transaction_base & | ,
|  | const PGSTD::string & | Name,
|  | ITER | begincolumns,
|  | ITER | endcolumns,
|  | const PGSTD::string & | Null |
| ) |  |  |

pqxx::tablereader::~tablereader | ( |  | ) | throw ()

## Member Function Documentation

template<typename TUPLE>

tablereader & pqxx::tablereader::operator>> | ( | TUPLE & |  | ) |

pqxx::tablereader::operator bool | ( |  | ) | const throw ()

bool pqxx::tablereader::operator! | ( |  | ) | const throw ()

bool pqxx::tablereader::get_raw_line | ( | PGSTD::string & | Line | ) |

Read a line of raw, unparsed table data.

Parameters:

  | Line | Variable to hold the raw data line read from the table.

Returns:
  Whether a line could be read

template<typename TUPLE>

void pqxx::tablereader::tokenize | ( | PGSTD::string | ,
|  | TUPLE & |  |
| ) |  |  | const

void pqxx::tablereader::complete | ( |  | ) | `[virtual]`

Finish stream action, check for errors, and detach from transaction.

It is recommended that you call this function before the tablestream's destructor is run. This function will check any final errors which may not become apparent until the transaction is committed otherwise.

As an added benefit, this will free up the transaction while the tablestream object itself still exists.

Implements pqxx::tablestream.

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

- tablereader.hxx
- tablereader.cxx