Audacity 3.2.0
Transaction.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 * SPDX-FileName: Transaction.h
4 * SPDX-FileContributor: Dmitry Vedenko
5 */
6
7#pragma once
8
9#include <string>
10#include <string_view>
11
12#include "Error.h"
13
14namespace audacity::sqlite
15{
16class Connection;
17
19class SQLITE_HELPERS_API Transaction final
20{
21 friend class Connection;
22
24 {
25 BeginOp,
26 CommitOp,
27 RollbackOp,
28 };
29
33 std::string_view name) noexcept;
34
35public:
36 Transaction(const Transaction&) = delete;
38
41
43
44 Error GetBeginResult() const noexcept;
45
46 bool IsOpen() const noexcept;
47
48 Error Commit() noexcept;
49 Error Abort() noexcept;
50
51private:
52 Connection& mConnection;
54 std::string mName;
55 Error mBeginResult {};
56 bool mCommitted {};
57};
58} // namespace audacity::sqlite
std::unique_ptr< DBConnection > Connection
Definition: DBConnection.h:132
wxString name
Definition: TagsEditor.cpp:166
A class representing a connection to a SQLite database.
Definition: Connection.h:48
A class representing an error in SQLite.
Definition: Error.h:17
A class representing a transaction in SQLite.
Definition: Transaction.h:20
Transaction & operator=(Transaction &&)=delete
Transaction & operator=(const Transaction &)=delete
Error(*)(Connection &, TransactionOperation, Transaction &) TransactionHandler
Definition: Transaction.h:30
Transaction(Transaction &&)=delete
Transaction(const Transaction &)=delete
STL namespace.