# pqxx::result::result::tuple Class Reference

Reference to one row in a result. More...

`#include <result.hxx>`

Inheritance diagram for pqxx::result::result::tuple:

[legend]

List of all members.

## Public Types
typedef unsigned int | size_type
typedef signed int | difference_type
typedef const_fielditerator | const_iterator
typedef field | reference
typedef const_fielditerator | pointer
typedef const_reverse_fielditerator | const_reverse_iterator
## Public Member Functions
| tuple (const result *r, result::size_type i) throw ()
| ~tuple () throw ()
const_iterator | begin () const throw ()
const_iterator | end () const throw ()
size_type | size () const throw ()
void | swap (tuple &) throw ()
result::size_type | rownumber () const throw ()
result::size_type | num () const
Comparison
bool | operator== (const tuple &) const throw ()
bool | operator!= (const tuple &rhs) const throw ()
Field access
reference | front () const throw ()
reference | back () const throw ()
const_reverse_fielditerator | rbegin () const
const_reverse_fielditerator | rend () const
reference | operator[] (size_type i) const throw ()
reference | operator[] (int i) const throw ()
reference | operator[] (const char[]) const
reference | operator[] (const std::string &s) const
reference | at (size_type) const throw (range_error)
reference | at (int i) const throw (range_error)
reference | at (const char[]) const
reference | at (const std::string &s) const
Column information
size_type | column_number (const std::string &ColName) const
| Number of given column (throws exception if it doesn't exist).
size_type | column_number (const char ColName[]) const
| Number of given column (throws exception if it doesn't exist).
oid | column_type (size_type ColNum) const
| Type of given column.
oid | column_type (int ColNum) const
| Type of given column.
oid | column_type (const std::string &ColName) const
| Type of given column.
oid | column_type (const char ColName[]) const
| Type of given column.
oid | column_table (size_type ColNum) const
| What table did this column come from? Requires PostgreSQL 7.4 C API.
oid | column_table (int ColNum) const
| What table did this column come from? Requires PostgreSQL 7.4 C API.
oid | column_table (const std::string &ColName) const
| What table did this column come from? Requires PostgreSQL 7.4 C API.
size_type | table_column (size_type ColNum) const
| What column number in its table did this result column come from?
size_type | table_column (int ColNum) const
| What column number in its table did this result column come from?
size_type | table_column (const std::string &ColName) const
| What column number in its table did this result column come from?
## Protected Member Functions
| tuple ()
## Protected Attributes
const result * | m_Home
result::size_type | m_Index
## Friends
class | field

## Detailed Description

Reference to one row in a result.

A tuple represents one row (also called a tuple) in a query result set. It also acts as a container mapping column numbers or names to field values (see below):

            cout << tuple["date"].c_str() << ": " << tuple["name"].c_str() << endl;

The tuple itself acts like a (non-modifyable) container, complete with its own const_iterator and const_reverse_iterator.

## Member Typedef Documentation

typedef const_fielditerator pqxx::result::result::tuple::const_iterator

typedef const_reverse_fielditerator pqxx::result::result::tuple::const_reverse_iterator

typedef signed int pqxx::result::result::tuple::difference_type

Reimplemented in pqxx::result::result::const_iterator.

typedef const_fielditerator pqxx::result::result::tuple::pointer

Reimplemented in pqxx::result::result::const_iterator.

typedef field pqxx::result::result::tuple::reference

Reimplemented in pqxx::result::result::const_iterator.

typedef unsigned int pqxx::result::result::tuple::size_type

Reimplemented in pqxx::result::result::const_iterator.

## Constructor & Destructor Documentation

pqxx::result::result::tuple::tuple | ( | const result * | r,
|  | result::size_type | i |
| ) |  |  | throw ()

pqxx::result::result::tuple::~tuple | ( |  | ) | throw ()

pqxx::result::result::tuple::tuple | ( |  | ) | `[protected]`

## Member Function Documentation

reference pqxx::result::result::tuple::at | ( | const std::string & | s | ) | const

References pqxx::result::result::tuple::at().

Referenced by pqxx::result::result::tuple::at().

pqxx::result::field pqxx::result::result::tuple::at | ( | const char | f[] | ) | const

References pqxx::result::column_number(), pqxx::result::result::tuple::field, and pqxx::result::result::tuple::m_Home.

reference pqxx::result::result::tuple::at | ( | int | i | ) | const throw (range_error)

References pqxx::result::result::tuple::at().

Referenced by pqxx::result::result::tuple::at().

pqxx::result::field pqxx::result::result::tuple::at | ( | size_type | i | ) | const throw (range_error)

References pqxx::result::operator[](), and pqxx::result::size().

reference pqxx::result::result::tuple::back | ( |  | ) | const throw ()

const_iterator pqxx::result::result::tuple::begin | ( |  | ) | const throw ()

Referenced by pqxx::result::result::tuple::rend().

size_type pqxx::result::result::tuple::column_number | ( | const char | ColName[] | ) | const

Number of given column (throws exception if it doesn't exist).

size_type pqxx::result::result::tuple::column_number | ( | const std::string & | ColName | ) | const

Number of given column (throws exception if it doesn't exist).

References pqxx::result::result::tuple::column_number().

Referenced by pqxx::result::result::tuple::column_number().

oid pqxx::result::result::tuple::column_table | ( | const std::string & | ColName | ) | const

What table did this column come from? Requires PostgreSQL 7.4 C API.

Only defined if the libpqxx library was compiled against a libpq version that supports the `PQftable` function.

If you get a link error saying this function is undefined, that must be because libpqxx was compiled against an older version of libpq. The `PQftable` function first became available in PostgreSQL 7.4.

References pqxx::result::result::tuple::column_table().

Referenced by pqxx::result::result::tuple::column_table().

oid pqxx::result::result::tuple::column_table | ( | int | ColNum | ) | const

What table did this column come from? Requires PostgreSQL 7.4 C API.

Only defined if the libpqxx library was compiled against a libpq version that supports the `PQftable` function.

If you get a link error saying this function is undefined, that must be because libpqxx was compiled against an older version of libpq. The `PQftable` function first became available in PostgreSQL 7.4.

References pqxx::result::result::tuple::column_table().

Referenced by pqxx::result::result::tuple::column_table().

oid pqxx::result::result::tuple::column_table | ( | size_type | ColNum | ) | const

What table did this column come from? Requires PostgreSQL 7.4 C API.

Only defined if the libpqxx library was compiled against a libpq version that supports the `PQftable` function.

If you get a link error saying this function is undefined, that must be because libpqxx was compiled against an older version of libpq. The `PQftable` function first became available in PostgreSQL 7.4.

oid pqxx::result::result::tuple::column_type | ( | const char | ColName[] | ) | const

Type of given column.

References pqxx::result::result::tuple::column_type().

Referenced by pqxx::result::result::tuple::column_type().

oid pqxx::result::result::tuple::column_type | ( | const std::string & | ColName | ) | const

Type of given column.

References pqxx::result::result::tuple::column_type().

Referenced by pqxx::result::result::tuple::column_type().

oid pqxx::result::result::tuple::column_type | ( | int | ColNum | ) | const

Type of given column.

References pqxx::result::result::tuple::column_type().

Referenced by pqxx::result::result::tuple::column_type().

oid pqxx::result::result::tuple::column_type | ( | size_type | ColNum | ) | const

Type of given column.

const_iterator pqxx::result::result::tuple::end | ( |  | ) | const throw ()

Referenced by pqxx::result::result::tuple::rbegin().

reference pqxx::result::result::tuple::front | ( |  | ) | const throw ()

result::size_type pqxx::result::result::tuple::num | ( |  | ) | const

Referenced by pqxx::result::result::const_iterator::operator-().

bool pqxx::result::result::tuple::operator!= | ( | const tuple & | rhs | ) | const throw ()

bool pqxx::result::result::tuple::operator== | ( | const tuple & | rhs | ) | const throw ()

reference pqxx::result::result::tuple::operator[] | ( | const std::string & | s | ) | const

References pqxx::result::result::tuple::operator[]().

Referenced by pqxx::result::result::tuple::operator[]().

pqxx::result::field pqxx::result::result::tuple::operator[] | ( | const char | f[] | ) | const

References pqxx::result::column_number(), pqxx::result::result::tuple::field, and pqxx::result::result::tuple::m_Home.

reference pqxx::result::result::tuple::operator[] | ( | int | i | ) | const throw ()

References pqxx::result::result::tuple::operator[]().

Referenced by pqxx::result::result::tuple::operator[]().

reference pqxx::result::result::tuple::operator[] | ( | size_type | i | ) | const throw ()

result::tuple::const_reverse_iterator pqxx::result::result::tuple::rbegin | ( |  | ) | const

References pqxx::result::result::tuple::end().

result::tuple::const_reverse_iterator pqxx::result::result::tuple::rend | ( |  | ) | const

References pqxx::result::result::tuple::begin().

result::size_type pqxx::result::result::tuple::rownumber | ( |  | ) | const throw ()

size_type pqxx::result::result::tuple::size | ( |  | ) | const throw ()

void pqxx::result::result::tuple::swap | ( | tuple & | rhs | ) | throw ()

size_type pqxx::result::result::tuple::table_column | ( | const std::string & | ColName | ) | const

What column number in its table did this result column come from?

References pqxx::result::result::tuple::table_column().

Referenced by pqxx::result::result::tuple::table_column().

size_type pqxx::result::result::tuple::table_column | ( | int | ColNum | ) | const

What column number in its table did this result column come from?

References pqxx::result::result::tuple::table_column().

Referenced by pqxx::result::result::tuple::table_column().

size_type pqxx::result::result::tuple::table_column | ( | size_type | ColNum | ) | const

What column number in its table did this result column come from?

A meaningful answer can be given only if the column in question comes directly from a column in a table. If the column is computed in any other way, a logic_error will be thrown.

Parameters:

  | ColNum | a zero-based column number in this result set

Returns:
  a zero-based column number in originating table

Requires libpq from PostgreSQL 7.4 or better, as well as a server version of at least 7.4.

## Friends And Related Function Documentation

friend class field`[friend]`

Referenced by pqxx::result::result::tuple::at(), and pqxx::result::result::tuple::operator[]().

## Member Data Documentation

const result* pqxx::result::result::tuple::m_Home`[protected]`

Referenced by pqxx::result::result::tuple::at(), pqxx::result::result::const_iterator::operator+(), pqxx::result::result::const_iterator::operator-(), and pqxx::result::result::tuple::operator[]().

result::size_type pqxx::result::result::tuple::m_Index`[protected]`

Referenced by pqxx::result::result::const_iterator::operator+(), pqxx::result::result::const_iterator::operator++(), pqxx::result::result::const_iterator::operator-(), pqxx::result::result::const_iterator::operator--(), and pqxx::result::result::const_iterator::operator==().

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

- result.hxx
- result.cxx