MySQLaux 0.6 is free software from Langensoft written by Thomas Langen.

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

MySQLaux::Row Class Reference

A Row is a sequence of Fields of a specific length. More...

#include <Row.h>

Inheritance diagram for MySQLaux::Row

Inheritance graph
[legend]
List of all members.

Public Methods

 Row (MYSQL_ROW rawData, MYSQL_FIELD *field_info, unsigned long *lengths, unsigned number, GarbageCollector &gc) throw (MissingFeature)
 Constructor. More...

 Row (Row const &other)
 Copy constructor. More...

 ~Row ()
 Destructor. More...

Field const& operator[] (unsigned int index) const throw (NullFieldIndicator, range_error)
 Get constant field. More...

Fieldoperator[] (unsigned int index) throw (NullFieldIndicator, std::range_error)
 Get variable field. More...

template<class T> T const& value (unsigned int index) const throw (NullFieldIndicator, std::bad_cast, std::range_error)
 Get value of constant field. More...

size_t size () const
 Get size of row (number of fields). More...

size_t size (unsigned int index) const throw (range_error)
 Get size of field value (number of bytes). More...


Detailed Description

A Row is a sequence of Fields of a specific length.

Note that there is no intrinsic information of the meaning of the fields besides their sizes.

Definition at line 45 of file Row.h.


Constructor & Destructor Documentation

MySQLaux::Row::Row ( MYSQL_ROW rawData,
MYSQL_FIELD * field_info,
unsigned long * lengths,
unsigned number,
GarbageCollector & gc ) throw (MissingFeature)
 

Constructor.

As a garbage collector information, field reference counts are initialized with 1.

Parameters:
rawData   raw data
field_info   field information
lengths   field lengths in bytes
number   number of fields
gc   garbage collector

MySQLaux::Row::Row ( Row const & other )
 

Copy constructor.

Field reference counts for the garbage collector are increased by 1.

Parameters:
other   row to be copied. Row instances is changed.

MySQLaux::Row::~Row ( )
 

Destructor.

Field reference counts for the garbage collector are decreased by 1, or deleted if they reach 0.


Member Function Documentation

Field & MySQLaux::Row::operator[] ( unsigned int index ) throw (NullFieldIndicator, std::range_error)
 

Get variable field.

Parameters:
index   field index, checked to be valid
Returns:
indexed field

Field const & MySQLaux::Row::operator[] ( unsigned int index ) const throw (NullFieldIndicator, range_error)
 

Get constant field.

Parameters:
index   field index, checked to be valid
Returns:
indexed field

size_t MySQLaux::Row::size ( unsigned int index ) const throw (range_error) [inline]
 

Get size of field value (number of bytes).

Definition at line 127 of file Row.h.

00129     {
00130       if (index >= vector<Field *>::size())
00131         throw range_error("invalid field index for MySQLaux::Row");
00132       return (*this)[index].size();
00133 

size_t MySQLaux::Row::size ( ) const [inline]
 

Get size of row (number of fields).

Definition at line 119 of file Row.h.

00120     {
00121       return vector<Field *>::size();
00122 

template<class T>
T const & MySQLaux::Row::value ( unsigned int index ) const throw (NullFieldIndicator, std::bad_cast, std::range_error) [inline]
 

Get value of constant field.

This method template replaces ugly constructs like (dynamic_cast<MySQLaux::TypedField<string> const &>((*row)[0])).value().

Parameters:
T   field type
index   field index, checked to be valid
Returns:
value of indexed field
Exceptions:
NullFieldIndicator   for null field

Definition at line 108 of file Row.h.

00112     {
00113       return (dynamic_cast<MySQLaux::TypedField<T> const &>((*this)[index]).value());
00114 


The documentation for this class was generated from the following file:
Generated at Fri Apr 6 11:20:16 2001 for MySQLaux by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001