Akonadi

transaction.cpp
1/*
2 SPDX-FileCopyrightText: 2006 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "transaction.h"
8#include "storage/datastore.h"
9
10using namespace Akonadi::Server;
11
12Transaction::Transaction(DataStore *db, const QString &name, bool beginTransaction)
13 : mDb(db)
14 , mName(name)
15 , mCommitted(false)
16{
17 if (beginTransaction) {
18 mDb->beginTransaction(mName);
19 }
20}
21
23{
24 if (!mCommitted) {
26 }
27}
28
30{
31 mCommitted = true;
32 return mDb->commitTransaction();
33}
34
35void Transaction::begin()
36{
37 mDb->beginTransaction(mName);
38 mCommitted = false;
39}
This class handles all the database access.
Definition datastore.h:95
virtual bool beginTransaction(const QString &name)
Begins a transaction.
virtual bool rollbackTransaction()
Reverts all changes within the current transaction.
virtual bool commitTransaction()
Commits all changes within the current transaction and emits all collected notification signals.
~Transaction()
Rolls back the transaction if it hasn't been committed explicitly.
bool commit()
Commits the transaction.
Transaction(DataStore *db, const QString &name, bool beginTransaction=true)
Starts a new transaction.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.