Akonadi::Server::Transaction

Search for usage in LXR

Akonadi::Server::Transaction Class Reference

#include <transaction.h>

Public Member Functions

 Transaction (DataStore *db, const QString &name, bool beginTransaction=true)
 
 ~Transaction ()
 
void begin ()
 
bool commit ()
 

Detailed Description

Helper class for DataStore transaction handling.

Works similar to QMutexLocker. Supports command-local and session-global transactions.

Definition at line 22 of file transaction.h.

Constructor & Destructor Documentation

◆ Transaction()

Transaction::Transaction ( DataStore * db,
const QString & name,
bool beginTransaction = true )
explicit

Starts a new transaction.

The transaction will automatically rolled back on destruction if it hasn't been committed explicitly before. If there is already a global transaction in progress, this one will be used instead of creating a new one.

Parameters
dbThe corresponding DataStore. You must not delete db during the lifetime of a Transaction object.
nameA name of the transaction. Used for debugging.
beginTransactionif false, the transaction won't be started, until begin is explicitly called. The default is to begin the transaction right away.

Definition at line 12 of file transaction.cpp.

◆ ~Transaction()

Transaction::~Transaction ( )

Rolls back the transaction if it hasn't been committed explicitly.

This also happens if a global transaction is used.

Definition at line 22 of file transaction.cpp.

Member Function Documentation

◆ begin()

void Transaction::begin ( )

Definition at line 35 of file transaction.cpp.

◆ commit()

bool Transaction::commit ( )

Commits the transaction.

Returns true on success. If a global transaction is used, nothing happens, global transactions have to be committed explicitly.

Definition at line 29 of file transaction.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:39 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.