Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter Class Reference
Collaboration diagram for audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter:
[legend]

Public Member Functions

 SQLiteIniter ()
 
 ~SQLiteIniter ()
 
Error GetError () const noexcept
 
void SetLogCallback (LogCallback callback)
 

Static Public Member Functions

static void SQLiteLogCallback (void *initer, int code, const char *msg)
 

Private Attributes

Error mError
 
LogCallback mLogCallback
 

Detailed Description

Definition at line 22 of file SQLiteUtils.cpp.

Constructor & Destructor Documentation

◆ SQLiteIniter()

audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::SQLiteIniter ( )
inline

Definition at line 25 of file SQLiteUtils.cpp.

26 {
27 // Enable URI filenames for all connections
28 mError = Error(sqlite3_config(SQLITE_CONFIG_URI, 1));
29
30 if (mError.IsError())
31 return;
32
33 mError =
34 Error(sqlite3_config(SQLITE_CONFIG_LOG, SQLiteLogCallback, this));
35
36 if (mError.IsError())
37 return;
38
39 mError = Error(sqlite3_initialize());
40
41#ifdef NO_SHM
42 if (mError.IsError())
43 return;
44
45 // Use the "unix-excl" VFS to make access to the DB exclusive. This
46 // gets rid of the "<database name>-shm" shared memory file.
47 //
48 // Though it shouldn't, it doesn't matter if this fails.
49 auto vfs = sqlite3_vfs_find("unix-excl");
50 if (vfs)
51 sqlite3_vfs_register(vfs, 1);
52#endif
53 }
bool IsError() const noexcept
Returns true if the object represents an error.
Definition: Error.cpp:25
static void SQLiteLogCallback(void *initer, int code, const char *msg)
Definition: SQLiteUtils.cpp:62

◆ ~SQLiteIniter()

audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::~SQLiteIniter ( )
inline

Definition at line 55 of file SQLiteUtils.cpp.

56 {
57 // This function must be called single-threaded only
58 // It returns a value, but there's nothing we can do with it
59 (void)sqlite3_shutdown();
60 }

Member Function Documentation

◆ GetError()

Error audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::GetError ( ) const
inlinenoexcept

Definition at line 70 of file SQLiteUtils.cpp.

71 {
72 return mError;
73 }

Referenced by audacity::sqlite::Initialize().

Here is the caller graph for this function:

◆ SetLogCallback()

void audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::SetLogCallback ( LogCallback  callback)
inline

Definition at line 75 of file SQLiteUtils.cpp.

76 {
77 mLogCallback = std::move(callback);
78 }

Referenced by audacity::sqlite::SetLogCallback().

Here is the caller graph for this function:

◆ SQLiteLogCallback()

static void audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::SQLiteLogCallback ( void *  initer,
int  code,
const char *  msg 
)
inlinestatic

Definition at line 62 of file SQLiteUtils.cpp.

63 {
64 SQLiteIniter* self = static_cast<SQLiteIniter*>(initer);
65
66 if (self->mLogCallback)
67 self->mLogCallback(code, msg);
68 }

References mLogCallback.

Member Data Documentation

◆ mError

Error audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::mError
private

Definition at line 81 of file SQLiteUtils.cpp.

◆ mLogCallback

LogCallback audacity::sqlite::anonymous_namespace{SQLiteUtils.cpp}::SQLiteIniter::mLogCallback
private

Definition at line 82 of file SQLiteUtils.cpp.

Referenced by SQLiteLogCallback().


The documentation for this class was generated from the following file: