segadb.transaction

 
Classes
       
builtins.object
Transaction

 
class Transaction(builtins.object)
    Transaction(database)
 

 
  Methods defined here:
__init__(self, database)
Initializes a new transaction instance.
Args:
    database: The database object to associate with this transaction.
 
Attributes:
    database: The database object associated with this transaction.
    operations: A list to store the operations performed in this transaction.
add_operation(self, operation)
Adds an operation to the list of operations.
Args:
    operation: The operation to be added to the list.
begin(self)
Begins a new transaction.  
This method initializes the operations list and creates a shadow copy
of the current state of the database. The shadow copy is stored in the
database to allow for rollback if needed.
commit(self)
Commits the current transaction by executing all operations in the transaction.  
This method iterates over the list of operations and executes each one. After all operations
are executed, it clears the list of operations and discards the shadow copy of the database.
copy(self)
Copies a transaction object.
preview(self)
Previews the operations in the current transaction without committing or rolling back.
rollback(self)
Reverts the database to its previous state using a shadow copy if available.  
This method restores the database to the state saved in the shadow copy,
clears the list of operations, and removes the shadow copy reference.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object