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

pqxxobject::row< Row > Class Template Reference

Database row template class. More...

#include <row.h>

Inheritance diagram for pqxxobject::row< Row >:

pqxxobject::row_base Object List of all members.

Public Types

typedef std::auto_ptr< Row > row_ptr
 Row object pointer.


Public Member Functions

 row ()
 The constructor.

 row (row_state status, bool modified=false)
 The constructor.

 row (const row &rhs)
 The copy constructor.

virtual ~row ()
 The destructor.

rowoperator= (const row &rhs)
 The assignment operator.


Static Public Member Functions

row_ptr create (pqxx::result::const_iterator row, pqxxobject::transaction &tran)
 Create a new row object from an SQL result set.


Private Member Functions

bool get_checkpoint () const
 Find if a checkpoint object exists for this row.

void begin_impl (pqxxobject::transaction &tran)
 Begin a transaction (checkpoint).

void abort_impl (pqxxobject::transaction &tran)
 Recover from transaction abort (roll back to checkpoint).

void commit_impl (pqxxobject::transaction &tran)
 Recover from transaction commit (refresh or roll back to checkpoint).


Private Attributes

Row * m_checkpoint
 Checkpoint object, used to save state for transaction rollback.


Detailed Description

template<typename Row>
class pqxxobject::row< Row >

Database row template class.

The class represents a single row in a database table (or result set). This class should be derived from by your own row class. For example:

 class Address : public libpqxxobject::row<Address>
 {
 private:
   libpqxx::column<int> m_id; // Primary key
   libpqxx::column<std::string> name; // Name
   libpqxx::column<std::string> street; // Street
 [...]
 }
Your class should provide:

Definition at line 82 of file row.h.


Member Typedef Documentation

template<typename Row>
typedef std::auto_ptr<Row> pqxxobject::row< Row >::row_ptr
 

Row object pointer.

Definition at line 90 of file row.h.

Referenced by pqxxobject::row< Row >::create().


Constructor & Destructor Documentation

template<typename Row>
pqxxobject::row< Row >::row  )  [inline]
 

The constructor.

Definition at line 93 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
pqxxobject::row< Row >::row row_state  status,
bool  modified = false
[inline, explicit]
 

The constructor.

Parameters:
status the row status.
modified true if the row is modified, otherwise false.

Definition at line 103 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
pqxxobject::row< Row >::row const row< Row > &  rhs  )  [inline]
 

The copy constructor.

Parameters:
rhs the object to copy.

Definition at line 113 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
virtual pqxxobject::row< Row >::~row  )  [inline, virtual]
 

The destructor.

Definition at line 120 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.


Member Function Documentation

template<typename Row>
void pqxxobject::row< Row >::abort_impl pqxxobject::transaction tran  )  [inline, private, virtual]
 

Recover from transaction abort (roll back to checkpoint).

This default method does nothing and should be overridden by derived classes.

Parameters:
tran the transaction which will be used to execute queries.

Implements pqxxobject::row_base.

Definition at line 189 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
void pqxxobject::row< Row >::begin_impl pqxxobject::transaction tran  )  [inline, private, virtual]
 

Begin a transaction (checkpoint).

This default method does nothing and should be overridden by derived classes.

Parameters:
tran the transaction which will be used to execute queries.

Implements pqxxobject::row_base.

Definition at line 167 of file row.h.

References pqxxobject::transaction::get_checkpoint(), and pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
void pqxxobject::row< Row >::commit_impl pqxxobject::transaction tran  )  [inline, private, virtual]
 

Recover from transaction commit (refresh or roll back to checkpoint).

This default method does nothing and should be overridden by derived classes.

Parameters:
tran the transaction which will be used to execute queries.

Implements pqxxobject::row_base.

Definition at line 220 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
row_ptr pqxxobject::row< Row >::create pqxx::result::const_iterator  row,
pqxxobject::transaction tran
[inline, static]
 

Create a new row object from an SQL result set.

Parameters:
row an interator pointing to a row of an SQL result set.
tran a PostgreSQL transaction object.
Returns:
a Place.

Definition at line 152 of file row.h.

References pqxxobject::row< Row >::row_ptr.

template<typename Row>
bool pqxxobject::row< Row >::get_checkpoint  )  const [inline, private, virtual]
 

Find if a checkpoint object exists for this row.

Returns:
true if a checkpoint object exists.

Implements pqxxobject::row_base.

Definition at line 162 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.

template<typename Row>
row& pqxxobject::row< Row >::operator= const row< Row > &  rhs  )  [inline]
 

The assignment operator.

Parameters:
rhs the object to assign from.

Definition at line 136 of file row.h.

References pqxxobject::row< Row >::m_checkpoint.


Member Data Documentation

template<typename Row>
Row* pqxxobject::row< Row >::m_checkpoint [private]
 

Checkpoint object, used to save state for transaction rollback.

Definition at line 86 of file row.h.

Referenced by pqxxobject::row< Row >::abort_impl(), pqxxobject::row< Row >::begin_impl(), pqxxobject::row< Row >::commit_impl(), pqxxobject::row< Row >::get_checkpoint(), pqxxobject::row< Row >::operator=(), pqxxobject::row< Row >::row(), and pqxxobject::row< Row >::~row().


The documentation for this class was generated from the following file:
Generated on Thu Apr 1 10:37:56 2004 for pqxx-object API Reference by doxygen 1.3.5