Gda.XaTransaction¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
object |
r |
Class Details¶
- class Gda.XaTransaction(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(format, global_transaction_id)¶
- Parameters:
- Returns:
the newly created object.
- Return type:
Creates a new
Gda.XaTransaction
object, which will control the process of performing a distributed transaction across several connections.
- begin()¶
- Raises:
- Returns:
True
if no error occurred- Return type:
Begins a distributed transaction (managed by self). 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 self.
- commit()¶
- Raises:
- Returns:
True
if no error occurred (there may be some connections to recover, though)- cnc_to_recover:
a place to store the list of connections for which the commit phase failed, or
None
- Return type:
(
bool
, cnc_to_recover: [Gda.Connection
])
Commits a distributed transaction (managed by self). 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 self, 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).
- commit_recovered()¶
- Raises:
- Returns:
True
if all the data which was still uncommitted has been committed- 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
None
- Return type:
(
bool
, cnc_to_recover: [Gda.Connection
])
Tries to commit the data prepared but which failed to commit (see
Gda.XaTransaction.commit
()). This method allows one to terminate a distributed transaction which succeeded but for which some connections needed to be recovered.
- register_connection(cnc, branch)¶
- Parameters:
cnc (
Gda.Connection
) – the connection to add to selfbranch (
str
) – the branch qualifier
- Raises:
- Returns:
True
if no error occurred- Return type:
Registers cnc to be used by self to create a distributed transaction.
Note: any
Gda.Connection
object can only be registered with at most oneGda.XaTransaction
object; also some connections may not be registered at all with aGda.XaTransaction
object because the database provider being used does not support it.
- rollback()¶
- Raises:
- Returns:
True
if no error occurred- Return type:
Cancels a distributed transaction (managed by self).
- unregister_connection(cnc)¶
- Parameters:
cnc (
Gda.Connection
) – the connection to add to self
Unregisters cnc to be used by self to create a distributed transaction. This is the opposite of
Gda.XaTransaction.register_connection
().
Property Details¶
- Gda.XaTransaction.props.format_id¶
- Name:
format-id
- Type:
- Default Value:
1
- Flags: