libgdamm 4.99.11

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gnome::Gda::XaTransaction Class Reference

Distributed transaction manager. More...

Inheritance diagram for Gnome::Gda::XaTransaction:
[legend]
Collaboration diagram for Gnome::Gda::XaTransaction:
[legend]

## Public Types
typedef std::vector< Glib::RefPtr< const Connection > > | ConnectionVector
Public Types inherited from Glib::Object
typedef void(* | DestroyNotify) (gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| XaTransaction (XaTransaction&& src) noexcept
XaTransaction& | operator= (XaTransaction&& src) noexcept
virtual | ~XaTransaction () noexcept
GdaXaTransaction* | gobj ()
| Provides access to the underlying C GObject. More...
const GdaXaTransaction* | gobj () const
| Provides access to the underlying C GObject. More...
GdaXaTransaction* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
bool | register_connection (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& branch)
| Registers cnc to be used by xa_trans to create a distributed transaction. More...
void | unregister_connection (const Glib::RefPtr< Connection >& cnc)
| Unregisters cnc to be used by xa_trans to create a distributed transaction. More...
bool | begin ()
| Begins a distributed transaction (managed by xa_trans). More...
bool | rollback ()
| Cancels a distributed transaction (managed by xa_trans). More...
bool | commit (ConnectionVector& cnc_to_recover)
| Commits a distributed transaction (managed by xa_trans). More...
bool | commit_recovered (ConnectionVector& cnc_to_recover)
| Tries to commit the data prepared but which failed to commit (see commit()). More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_transaction_id () const
Glib::PropertyProxy_ReadOnly< guint > | property_format_id () const
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable ()
| trackable (const trackable &src)
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< XaTransaction > | create (guint32 format_id, const Glib::ustring& transaction_id)

## Protected Member Functions
| XaTransaction (guint32 format_id, const Glib::ustring& transaction_id)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
virtual | ~Object () noexcept
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gnome::Gda::XaTransaction > | wrap (GdaXaTransaction* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

Distributed transaction manager.

## Member Typedef Documentation

typedef std::vector<Glib::RefPtr<const Connection> > Gnome::Gda::XaTransaction::ConnectionVector

## Constructor & Destructor Documentation

Gnome::Gda::XaTransaction::XaTransaction | ( | XaTransaction&& | src | ) |
| noexcept

virtual Gnome::Gda::XaTransaction::~XaTransaction | ( |  | ) |
| virtual noexcept

Gnome::Gda::XaTransaction::XaTransaction | ( | guint32 | format_id,
|  | const Glib::ustring & | transaction_id
| ) |  |
| explicit protected

## Member Function Documentation

bool Gnome::Gda::XaTransaction::begin | ( |  | ) |

Begins a distributed transaction (managed by xa_trans).

Please note that this phase may fail for some connections if a (normal) transaction is already started (this depends on the database provider being used), so it's better to avoid starting any (normal) transaction on any of the connections registered with xa_trans.

Returns
  `true` if no error occurred.

bool Gnome::Gda::XaTransaction::commit | ( | ConnectionVector& | cnc_to_recover | ) |

Commits a distributed transaction (managed by xa_trans).

The commit is composed of two phases:

- a PREPARE phase where all the connections are required to store their transaction data to a permanent place (to be able to complete the commit should a problem occur afterwards)
- a COMMIT phase where the transaction data is actually written to the database

If the PREPARE phase fails for any of the connection registered with xa_trans, then the distributed commit fails and `false` is returned. During the COMMIT phase, some commit may actually fail but the transaction can still be completed because the PREPARE phase succeeded (through the recover method).

Parameters

  cnc_to_recover | A place to store the list of connections for which the commit phase failed, or `0`.

Returns
  `true` if no error occurred (there may be some connections to recover, though).

bool Gnome::Gda::XaTransaction::commit_recovered | ( | ConnectionVector& | cnc_to_recover | ) |

Tries to commit the data prepared but which failed to commit (see commit()).

This method allows one to terminate a distributed transaction which succeeded but for which some connections needed to be recovered.

Parameters

  cnc_to_recover | A place to store the list of connections for which the there were data to recover and which failed to be actually committed, or `0`.

Returns
  `true` if all the data which was still uncommitted has been committed.

static Glib::RefPtr<XaTransaction> Gnome::Gda::XaTransaction::create | ( | guint32 | format_id,
|  | const Glib::ustring & | transaction_id
| ) |  |
| static

static GType Gnome::Gda::XaTransaction::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

GdaXaTransaction* Gnome::Gda::XaTransaction::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GdaXaTransaction* Gnome::Gda::XaTransaction::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GdaXaTransaction* Gnome::Gda::XaTransaction::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

XaTransaction& Gnome::Gda::XaTransaction::operator= | ( | XaTransaction&& | src | ) |
| noexcept

Glib::PropertyProxy_ReadOnly< guint > Gnome::Gda::XaTransaction::property_format_id | ( |  | ) | const

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gnome::Gda::XaTransaction::property_transaction_id | ( |  | ) | const

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

bool Gnome::Gda::XaTransaction::register_connection | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | branch
| ) |  |

Registers cnc to be used by xa_trans to create a distributed transaction.

Note
  any Gda::Connection object can only be registered with at most one Gda::XaTransaction object; also some connections may not be registered at all with a Gda::XaTransaction object because the database provider being used does not support it.

Parameters

  cnc | The connection to add to xa_trans.
  branch | The branch qualifier.

Returns
  `true` if no error occurred.

bool Gnome::Gda::XaTransaction::rollback | ( |  | ) |

Cancels a distributed transaction (managed by xa_trans).

Returns
  `true` if no error occurred.

void Gnome::Gda::XaTransaction::unregister_connection | ( | const Glib::RefPtr< Connection >& | cnc | ) |

Unregisters cnc to be used by xa_trans to create a distributed transaction.

This is the opposite of register_connection().

Parameters

  cnc | The connection to add to xa_trans.

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::XaTransaction > wrap | ( | GdaXaTransaction * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

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

- libgdamm/xatransaction.h