libpqxx  4.0.1
pqxx::tuple Class Reference

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

#include <tuple.hxx>

Inheritance diagram for pqxx::tuple:
pqxx::const_result_iterator pqxx::const_reverse_result_iterator

Public Types

typedef tuple_size_type size_type
 
typedef tuple_difference_type difference_type
 
typedef const_tuple_iterator const_iterator
 
typedef const_iterator iterator
 
typedef field reference
 
typedef const_tuple_iterator pointer
 
typedef const_reverse_tuple_iterator const_reverse_iterator
 
typedef const_reverse_iterator reverse_iterator
 

Public Member Functions

 tuple (const result *r, size_t i) throw ()
 
 ~tuple () throw ()
 
const_iterator begin () const throw ()
 
const_iterator end () const throw ()
 
size_type size () const throw ()
 
void swap (tuple &) throw ()
 
size_t rownumber () const throw ()
 
size_t num () const
 
tuple slice (size_type Begin, size_type End) const
 
bool PQXX_PURE empty () const throw ()
 
Comparison
bool PQXX_PURE operator== (const tuple &) const throw ()
 
bool operator!= (const tuple &rhs) const throw ()
 
Field access
reference front () const throw ()
 
reference back () const throw ()
 
const_reverse_tuple_iterator rbegin () const
 
const_reverse_tuple_iterator rend () const
 
reference operator[] (size_type) const throw ()
 
reference operator[] (int) const throw ()
 
reference operator[] (const char[]) const
 
reference operator[] (const std::string &) const
 
reference at (size_type) const throw (pqxx::range_error)
 
reference at (int) const throw (pqxx::range_error)
 
reference at (const char[]) const
 
reference at (const std::string &) const
 
Column information
size_type column_number (const std::string &ColName) const
 Number of given column (throws exception if it doesn't exist) More...
 
size_type column_number (const char[]) const
 Number of given column (throws exception if it doesn't exist) More...
 
oid column_type (size_type) const
 Type of given column. More...
 
oid column_type (int ColNum) const
 Type of given column. More...
 
oid column_type (const std::string &ColName) const
 Type of given column. More...
 
oid column_type (const char ColName[]) const
 Type of given column. More...
 
oid column_table (size_type ColNum) const
 What table did this column come from? More...
 
oid column_table (int ColNum) const
 What table did this column come from? More...
 
oid column_table (const std::string &ColName) const
 What table did this column come from? More...
 
size_type table_column (size_type) const
 What column number in its table did this result column come from? More...
 
size_type table_column (int ColNum) const
 What column number in its table did this result column come from? More...
 
size_type table_column (const std::string &ColName) const
 What column number in its table did this result column come from? More...
 

Protected Attributes

const resultm_Home
 
size_t m_Index
 
size_type m_Begin
 
size_type m_End
 

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

◆ const_iterator

◆ const_reverse_iterator

◆ difference_type

◆ iterator

◆ pointer

◆ reference

◆ reverse_iterator

◆ size_type

Constructor & Destructor Documentation

◆ tuple()

pqxx::tuple::tuple ( const result r,
size_t  i 
)
throw (
)
Deprecated:
Do not use this constructor. It will become private.

References tuple().

Referenced by tuple().

◆ ~tuple()

pqxx::tuple::~tuple ( )
throw (
)

Member Function Documentation

◆ at() [1/4]

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

Referenced by pqxx::pipeline::resume().

◆ at() [2/4]

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

◆ at() [3/4]

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

◆ at() [4/4]

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

◆ back()

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

◆ begin()

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

◆ column_number() [1/2]

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

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

◆ column_number() [2/2]

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

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

References pqxx::result::column_number().

◆ column_table() [1/3]

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

What table did this column come from?

◆ column_table() [2/3]

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

What table did this column come from?

◆ column_table() [3/3]

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

What table did this column come from?

◆ column_type() [1/4]

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

Type of given column.

◆ column_type() [2/4]

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

Type of given column.

◆ column_type() [3/4]

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

Type of given column.

◆ column_type() [4/4]

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

Type of given column.

◆ empty()

bool pqxx::tuple::empty ( ) const
throw (
)

◆ end()

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

◆ front()

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

◆ num()

size_t pqxx::tuple::num ( ) const

◆ operator!=()

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

◆ operator==()

bool pqxx::tuple::operator== ( const tuple rhs) const
throw (
)

◆ operator[]() [1/4]

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

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

pqxx::tuple::reference pqxx::tuple::operator[] ( const char  f[]) const

◆ operator[]() [4/4]

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

◆ rbegin()

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

◆ rend()

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

◆ rownumber()

size_t pqxx::tuple::rownumber ( ) const
throw (
)

◆ size()

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

◆ slice()

pqxx::tuple pqxx::tuple::slice ( size_type  Begin,
size_type  End 
) const

Produce a slice of this tuple, containing the given range of columns.

The slice runs from the range's starting column to the range's end column, exclusive. It looks just like a normal result tuple, except slices can be empty.

Warning
Slicing is a relatively new feature, and not all software may be prepared to deal with empty slices. If there is any chance that your program might be creating empty slices and passing them to code that may not be designed with the possibility of empty tuples in mind, be sure to test for that case.

References m_Begin, and m_End.

◆ swap()

void pqxx::tuple::swap ( tuple rhs)
throw (
)

◆ table_column() [1/3]

pqxx::tuple::size_type pqxx::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
ColNuma 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.

◆ table_column() [2/3]

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

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

◆ table_column() [3/3]

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

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

Friends And Related Function Documentation

◆ field

friend class field
friend

Member Data Documentation

◆ m_Begin

size_type pqxx::tuple::m_Begin
protected

Referenced by slice().

◆ m_End

size_type pqxx::tuple::m_End
protected

Referenced by slice().

◆ m_Home

const result* pqxx::tuple::m_Home
protected

◆ m_Index

size_t pqxx::tuple::m_Index
protected

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