Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDatabaseTransactionLock.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include <QDebug>
10#include <QSqlError>
11
12#include <kis_assert.h>
13
14
15namespace detail
16{
17
19 : m_database(database)
20{
21}
22
24{
26 if (!m_database.transaction()) {
27 qWarning() << "WARNING: Failed to start a transaction:" << m_database.lastError().text();
28 } else {
30 }
31}
32
34{
36 return;
37
38 if (!m_database.rollback()) {
39 qWarning() << "WARNING: Failed to rollback a transaction:" << m_database.lastError().text();
40 }
41
43}
44
46{
48 return;
49
50 if (!m_database.commit()) {
51 qWarning() << "WARNING: Failed to commit a transaction:" << m_database.lastError().text();
52 }
53
55}
56
57} // namespace detail
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128