12#ifndef __AUDACITY_DB_CONNECTION__
13#define __AUDACITY_DB_CONNECTION__
16#include <condition_variable>
45 const std::weak_ptr<AudacityProject> &pProject,
46 const std::shared_ptr<DBConnectionErrors> &pErrors,
58 [[noreturn]]
void ThrowException(
62 int SafeMode(
const char *schema =
"main");
63 int FastMode(
const char* schema =
"main");
64 int SetPageSize(
const char* schema =
"main");
71 int GetLastRC()
const ;
72 const wxString GetLastMessage()
const;
83 GetAllSampleBlocksSize
85 sqlite3_stmt *Prepare(
enum StatementID
id,
const char *sql);
87 void SetBypass(
bool bypass );
103 int OpenStepByStep(
const FilePath fileName);
104 int ModeConfig(sqlite3 *db,
const char *schema,
const char *config);
106 void CheckpointThread(sqlite3 *db,
const FilePath &fileName);
107 static int CheckpointHook(
void *data, sqlite3 *db,
const char *schema,
int pages);
117 std::atomic_bool mCheckpointStop{
false };
118 std::atomic_bool mCheckpointPending{
false };
119 std::atomic_bool mCheckpointActive{
false };
140 ,
public std::enable_shared_from_this< ConnectionPtr >
Utility ClientData::Site to register hooks into a host class that attach client data.
std::unique_ptr< DBConnection > Connection
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
~ConnectionPtr() override
static ConnectionPtr & Get(AudacityProject &project)
std::shared_ptr< DBConnectionErrors > mpErrors
std::mutex mCheckpointMutex
bool Assign(sqlite3 *handle)
std::mutex mStatementMutex
std::thread mCheckpointThread
std::condition_variable mCheckpointCondition
std::map< StatementIndex, sqlite3_stmt * > mStatements
std::function< void()> CheckpointFailureCallback
std::weak_ptr< AudacityProject > mpProject
CheckpointFailureCallback mCallback
std::pair< enum StatementID, std::thread::id > StatementIndex
Holds a msgid for the translation catalog; may also bind format arguments.
A convenient default parameter for class template Site.
TranslatableString mLastError
TranslatableString mLibraryError