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

pqxxobject::row_base Class Reference

Database row base class. More...

#include <row_base.h>

Inheritance diagram for pqxxobject::row_base:

Object pqxxobject::row< Row > List of all members.

Public Types

enum  row_state { STATE_UNINITIALISED, STATE_INITIALISED, STATE_INCONSISTENT }
 The state of the row. More...


Public Member Functions

virtual ~row_base ()
 The destructor.

row_baseoperator= (const row_base &rhs)
 Overloaded assignment operator.

row_state get_state () const
 Get the row status.

bool is_modified () const
 Get the row modification status.

void refresh (pqxxobject::transaction &tran)
 Refresh a row from a table.

void insert (pqxxobject::transaction &tran)
 Insert a row into a table.

void update (pqxxobject::transaction &tran)
 Update a row from a table.

void erase (pqxxobject::transaction &tran)
 Remove a row from a table.

void abort (pqxxobject::transaction &tran)
 Recover from transaction abort.

void commit (pqxxobject::transaction &tran)
 Recover from transaction commit.

SigC::Signal0< void > & signal_changed ()
 Signal emitted on row change.

SigC::Signal0< void > & signal_refreshed ()
 Signal emitted on refresh.

SigC::Signal0< void > & signal_inserted ()
 Signal emitted on insertion.

SigC::Signal0< void > & signal_updated ()
 Signal emitted on update.

SigC::Signal0< void > & signal_erased ()
 Signal emitted on deletion.

void raise_changed ()
 Raise the changed signal.

void raise_refreshed ()
 Raise the refreshed signal.

void raise_inserted ()
 Raise the inserted signal.

void raise_updated ()
 Raise the updated signal.

void raise_erased ()
 Raise the erased signal.


Protected Member Functions

 row_base ()
 The constructor.

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

 row_base (const row_base &rhs)
 The copy constructor.

void begin (pqxxobject::transaction &tran)
 Begin a database operation.

virtual void refresh_impl (pqxxobject::transaction &tran)
 Refresh a row from a table.

virtual void insert_impl (pqxxobject::transaction &tran)
 Insert a row into a table.

virtual void update_impl (pqxxobject::transaction &tran)
 Update a row from a table.

virtual void erase_impl (pqxxobject::transaction &tran)
 Remove a row from a table.

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

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

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

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

void unset_checkpoint (pqxxobject::transaction &tran)
 Check if the checkpoint status (in the transaction object) needs resetting.


Protected Attributes

row_state m_state
 The row state.

bool m_modified
 The row modification state.

SigC::Signal0< void > m_signal_changed
 The changed signal.

SigC::Signal0< void > m_signal_refreshed
 The refreshed signal.

SigC::Signal0< void > m_signal_inserted
 The inserted signal.

SigC::Signal0< void > m_signal_updated
 The updated signal.

SigC::Signal0< void > m_signal_erased
 The erased signal.


Private Member Functions

void connect_signal_handlers (pqxxobject::transaction &tran)
 Connect default signal handlers with the transaction.

void connect_safe_signal_handlers (pqxxobject::transaction &tran)
 Connect default signal handlers with the transaction.


Detailed Description

Database row base class.

This class provides the functionality common to all database rows of all types. Because it derives from SigC::Object, signals may be connected to it, and all classes which derive from it.

Definition at line 56 of file row_base.h.


Member Enumeration Documentation

enum pqxxobject::row_base::row_state
 

The state of the row.

Enumeration values:
STATE_UNINITIALISED  The row is uninitialised (either new or deleted), not existing in the database.

STATE_INITIALISED  The row exists in the database.
STATE_INCONSISTENT  The row exists in the database, but is inconsistent due to an unsuccessful or partially competed transaction.

Definition at line 60 of file row_base.h.


Constructor & Destructor Documentation

row_base::row_base  )  [protected]
 

The constructor.

Definition at line 66 of file row_base.cc.

row_base::row_base row_state  status,
bool  modified = false
[explicit, protected]
 

The constructor.

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

Definition at line 72 of file row_base.cc.

row_base::row_base const row_base rhs  )  [protected]
 

The copy constructor.

Parameters:
rhs the object to copy.

Definition at line 79 of file row_base.cc.

row_base::~row_base  )  [virtual]
 

The destructor.

Definition at line 86 of file row_base.cc.


Member Function Documentation

void row_base::abort pqxxobject::transaction tran  ) 
 

Recover from transaction abort.

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

Definition at line 221 of file row_base.cc.

References abort_impl().

Referenced by erase(), insert(), refresh(), and update().

virtual void pqxxobject::row_base::abort_impl pqxxobject::transaction tran  )  [protected, pure 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.

Implemented in pqxxobject::row< Row >.

Referenced by abort().

void row_base::begin pqxxobject::transaction tran  )  [protected]
 

Begin a database operation.

This method is responsible for setting row state and checkpoint objects.

Definition at line 293 of file row_base.cc.

References begin_impl(), m_state, and STATE_INCONSISTENT.

Referenced by erase(), insert(), refresh(), and update().

virtual void pqxxobject::row_base::begin_impl pqxxobject::transaction tran  )  [protected, pure 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.

Implemented in pqxxobject::row< Row >.

Referenced by begin().

void row_base::commit pqxxobject::transaction tran  ) 
 

Recover from transaction commit.

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

Definition at line 227 of file row_base.cc.

References commit_impl().

virtual void pqxxobject::row_base::commit_impl pqxxobject::transaction tran  )  [protected, pure 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.

Implemented in pqxxobject::row< Row >.

Referenced by commit().

void row_base::connect_safe_signal_handlers pqxxobject::transaction tran  )  [private]
 

Connect default signal handlers with the transaction.

Only "safe" signal handlers are connected (not signal_refresh) to prevent infinite loops during object refresh.

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

Definition at line 338 of file row_base.cc.

References pqxxobject::transaction::signal_abort(), and pqxxobject::transaction::signal_commit().

Referenced by erase(), and refresh().

void row_base::connect_signal_handlers pqxxobject::transaction tran  )  [private]
 

Connect default signal handlers with the transaction.

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

Definition at line 327 of file row_base.cc.

References pqxxobject::transaction::signal_abort(), pqxxobject::transaction::signal_commit(), and pqxxobject::transaction::signal_refresh().

Referenced by insert(), and update().

void row_base::erase pqxxobject::transaction tran  ) 
 

Remove a row from a table.

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

Definition at line 195 of file row_base.cc.

References abort(), begin(), connect_safe_signal_handlers(), describe_status(), erase_impl(), m_signal_erased, m_state, STATE_INITIALISED, and unset_checkpoint().

void row_base::erase_impl pqxxobject::transaction tran  )  [protected, virtual]
 

Remove a row from a table.

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

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

Definition at line 315 of file row_base.cc.

Referenced by erase().

virtual bool pqxxobject::row_base::get_checkpoint  )  const [protected, pure virtual]
 

Find if a checkpoint object exists for this row.

Returns:
true if a checkpoint object exists.

Implemented in pqxxobject::row< Row >.

Referenced by unset_checkpoint().

row_base::row_state row_base::get_state  )  const
 

Get the row status.

Returns:
the row status.

Definition at line 102 of file row_base.cc.

References m_state.

void row_base::insert pqxxobject::transaction tran  ) 
 

Insert a row into a table.

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

Definition at line 141 of file row_base.cc.

References abort(), begin(), connect_signal_handlers(), describe_status(), insert_impl(), m_modified, m_signal_inserted, m_state, STATE_UNINITIALISED, and unset_checkpoint().

void row_base::insert_impl pqxxobject::transaction tran  )  [protected, virtual]
 

Insert a row into a table.

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

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

Definition at line 305 of file row_base.cc.

Referenced by insert().

bool row_base::is_modified  )  const
 

Get the row modification status.

Returns:
true if the row has been modified, false otherwise.

Definition at line 108 of file row_base.cc.

References m_modified.

row_base & row_base::operator= const row_base rhs  ) 
 

Overloaded assignment operator.

Parameters:
rhs the object to assign.

Definition at line 91 of file row_base.cc.

References m_modified, and m_state.

void row_base::raise_changed  ) 
 

Raise the changed signal.

Definition at line 263 of file row_base.cc.

References m_signal_changed.

void row_base::raise_erased  ) 
 

Raise the erased signal.

Definition at line 287 of file row_base.cc.

References m_signal_erased.

void row_base::raise_inserted  ) 
 

Raise the inserted signal.

Definition at line 275 of file row_base.cc.

References m_signal_inserted.

void row_base::raise_refreshed  ) 
 

Raise the refreshed signal.

Definition at line 269 of file row_base.cc.

References m_signal_refreshed.

void row_base::raise_updated  ) 
 

Raise the updated signal.

Definition at line 281 of file row_base.cc.

References m_signal_updated.

void row_base::refresh pqxxobject::transaction tran  ) 
 

Refresh a row from a table.

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

Definition at line 114 of file row_base.cc.

References abort(), begin(), connect_safe_signal_handlers(), describe_status(), m_signal_refreshed, m_state, refresh_impl(), STATE_UNINITIALISED, and unset_checkpoint().

void row_base::refresh_impl pqxxobject::transaction tran  )  [protected, virtual]
 

Refresh a row from a table.

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

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

Definition at line 300 of file row_base.cc.

Referenced by refresh().

SigC::Signal0< void > & row_base::signal_changed  ) 
 

Signal emitted on row change.

Returns:
the signal.

Definition at line 233 of file row_base.cc.

References m_signal_changed.

SigC::Signal0< void > & row_base::signal_erased  ) 
 

Signal emitted on deletion.

Returns:
the signal.

Definition at line 257 of file row_base.cc.

References m_signal_erased.

SigC::Signal0< void > & row_base::signal_inserted  ) 
 

Signal emitted on insertion.

Returns:
the signal.

Definition at line 245 of file row_base.cc.

References m_signal_inserted.

SigC::Signal0< void > & row_base::signal_refreshed  ) 
 

Signal emitted on refresh.

Returns:
the signal.

Definition at line 239 of file row_base.cc.

References m_signal_refreshed.

SigC::Signal0< void > & row_base::signal_updated  ) 
 

Signal emitted on update.

Returns:
the signal.

Definition at line 251 of file row_base.cc.

References m_signal_updated.

void row_base::unset_checkpoint pqxxobject::transaction tran  )  [protected]
 

Check if the checkpoint status (in the transaction object) needs resetting.

Definition at line 320 of file row_base.cc.

References get_checkpoint(), pqxxobject::transaction::get_checkpoint(), and pqxxobject::transaction::set_checkpoint().

Referenced by erase(), insert(), refresh(), and update().

void row_base::update pqxxobject::transaction tran  ) 
 

Update a row from a table.

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

Definition at line 168 of file row_base.cc.

References abort(), begin(), connect_signal_handlers(), describe_status(), m_modified, m_signal_updated, m_state, STATE_INITIALISED, unset_checkpoint(), and update_impl().

void row_base::update_impl pqxxobject::transaction tran  )  [protected, virtual]
 

Update a row from a table.

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

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

Definition at line 310 of file row_base.cc.

Referenced by update().


Member Data Documentation

bool pqxxobject::row_base::m_modified [protected]
 

The row modification state.

Definition at line 80 of file row_base.h.

Referenced by insert(), is_modified(), operator=(), and update().

SigC::Signal0<void> pqxxobject::row_base::m_signal_changed [protected]
 

The changed signal.

Definition at line 83 of file row_base.h.

Referenced by raise_changed(), and signal_changed().

SigC::Signal0<void> pqxxobject::row_base::m_signal_erased [protected]
 

The erased signal.

Definition at line 91 of file row_base.h.

Referenced by erase(), raise_erased(), and signal_erased().

SigC::Signal0<void> pqxxobject::row_base::m_signal_inserted [protected]
 

The inserted signal.

Definition at line 87 of file row_base.h.

Referenced by insert(), raise_inserted(), and signal_inserted().

SigC::Signal0<void> pqxxobject::row_base::m_signal_refreshed [protected]
 

The refreshed signal.

Definition at line 85 of file row_base.h.

Referenced by raise_refreshed(), refresh(), and signal_refreshed().

SigC::Signal0<void> pqxxobject::row_base::m_signal_updated [protected]
 

The updated signal.

Definition at line 89 of file row_base.h.

Referenced by raise_updated(), signal_updated(), and update().

row_state pqxxobject::row_base::m_state [protected]
 

The row state.

Definition at line 78 of file row_base.h.

Referenced by begin(), erase(), get_state(), insert(), operator=(), refresh(), and update().


The documentation for this class was generated from the following files:
Generated on Thu Apr 1 12:53:11 2004 for pqxx-object API Reference by doxygen 1.3.5