#include <row_base.h>
Inheritance diagram for pqxxobject::row_base:
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_base & | operator= (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 | autoupdate (pqxxobject::transaction &tran) |
Update a row from a table, or insert the row if it is not yet present in the 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 Types | |
typedef std::pair< std::string, field_base * > | field_type |
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 | |
std::map< std::string, field_base * > | m_fields |
The row fields. | |
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. |
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 59 of file row_base.h.
|
Definition at line 80 of file row_base.h. |
|
The state of the row.
Definition at line 63 of file row_base.h. |
|
The constructor.
Definition at line 66 of file row_base.cc. |
|
The constructor.
Definition at line 72 of file row_base.cc. |
|
The copy constructor.
Definition at line 79 of file row_base.cc. |
|
The destructor.
Definition at line 86 of file row_base.cc. |
|
Recover from transaction abort.
Definition at line 231 of file row_base.cc. References abort_impl(). |
|
Recover from transaction abort (roll back to checkpoint). This default method does nothing and should be overridden by derived classes.
Implemented in pqxxobject::row< Row >. Referenced by abort(). |
|
Update a row from a table, or insert the row if it is not yet present in the table. This method uses insert() or an update() depending on whether the row has been inserted previously or not.
Definition at line 195 of file row_base.cc. References insert(), m_state, STATE_UNINITIALISED, and update(). |
|
Begin a database operation. This method is responsible for setting row state and checkpoint objects. Definition at line 303 of file row_base.cc. References begin_impl(), m_state, and STATE_INCONSISTENT. |
|
Begin a transaction (checkpoint). This default method does nothing and should be overridden by derived classes.
Implemented in pqxxobject::row< Row >. Referenced by begin(). |
|
Recover from transaction commit.
Definition at line 237 of file row_base.cc. References commit_impl(). |
|
Recover from transaction commit (refresh or roll back to checkpoint). This default method does nothing and should be overridden by derived classes.
Implemented in pqxxobject::row< Row >. Referenced by commit(). |
|
Connect default signal handlers with the transaction. Only "safe" signal handlers are connected (not signal_refresh) to prevent infinite loops during object refresh.
Definition at line 348 of file row_base.cc. References pqxxobject::transaction::signal_abort(), and pqxxobject::transaction::signal_commit(). |
|
Connect default signal handlers with the transaction.
Definition at line 337 of file row_base.cc. References pqxxobject::transaction::signal_abort(), pqxxobject::transaction::signal_commit(), and pqxxobject::transaction::signal_refresh(). |
|
Remove a row from a table.
Definition at line 205 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(). |
|
Remove a row from a table. This default method does nothing and should be overridden by derived classes.
Definition at line 325 of file row_base.cc. Referenced by erase(). |
|
Find if a checkpoint object exists for this row.
Implemented in pqxxobject::row< Row >. Referenced by unset_checkpoint(). |
|
Get the row status.
Definition at line 102 of file row_base.cc. References m_state. |
|
Insert a row into a table.
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(). Referenced by autoupdate(). |
|
Insert a row into a table. This default method does nothing and should be overridden by derived classes.
Definition at line 315 of file row_base.cc. Referenced by insert(). |
|
Get the row modification status.
Definition at line 108 of file row_base.cc. References m_modified. |
|
Overloaded assignment operator.
Definition at line 91 of file row_base.cc. References m_modified, and m_state. Referenced by pqxxobject::row< Row >::operator=(). |
|
Raise the changed signal.
Definition at line 273 of file row_base.cc. |
|
Raise the erased signal.
Definition at line 297 of file row_base.cc. References m_signal_erased. |
|
Raise the inserted signal.
Definition at line 285 of file row_base.cc. References m_signal_inserted. |
|
Raise the refreshed signal.
Definition at line 279 of file row_base.cc. References m_signal_refreshed. |
|
Raise the updated signal.
Definition at line 291 of file row_base.cc. References m_signal_updated. |
|
Refresh a row from a table.
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(). |
|
Refresh a row from a table. This default method does nothing and should be overridden by derived classes.
Definition at line 310 of file row_base.cc. Referenced by refresh(). |
|
Signal emitted on row change.
Definition at line 243 of file row_base.cc. |
|
Signal emitted on deletion.
Definition at line 267 of file row_base.cc. References m_signal_erased. |
|
Signal emitted on insertion.
Definition at line 255 of file row_base.cc. References m_signal_inserted. |
|
Signal emitted on refresh.
Definition at line 249 of file row_base.cc. References m_signal_refreshed. |
|
Signal emitted on update.
Definition at line 261 of file row_base.cc. References m_signal_updated. |
|
Check if the checkpoint status (in the transaction object) needs resetting.
Definition at line 330 of file row_base.cc. References get_checkpoint(), pqxxobject::transaction::get_checkpoint(), and pqxxobject::transaction::set_checkpoint(). |
|
Update a row from a table.
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(). Referenced by autoupdate(). |
|
Update a row from a table. This default method does nothing and should be overridden by derived classes.
Definition at line 320 of file row_base.cc. Referenced by update(). |
|
The row fields.
Definition at line 82 of file row_base.h. |
|
The row modification state.
Definition at line 87 of file row_base.h. Referenced by insert(), is_modified(), operator=(), and update(). |
|
The changed signal.
Definition at line 90 of file row_base.h. |
|
The erased signal.
Definition at line 98 of file row_base.h. Referenced by erase(), raise_erased(), and signal_erased(). |
|
The inserted signal.
Definition at line 94 of file row_base.h. Referenced by insert(), raise_inserted(), and signal_inserted(). |
|
The refreshed signal.
Definition at line 92 of file row_base.h. Referenced by raise_refreshed(), refresh(), and signal_refreshed(). |
|
The updated signal.
Definition at line 96 of file row_base.h. Referenced by raise_updated(), signal_updated(), and update(). |
|
The row state.
Definition at line 85 of file row_base.h. Referenced by autoupdate(), begin(), erase(), get_state(), insert(), operator=(), refresh(), and update(). |