Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
audacity::sqlite::Statement Class Referencefinal

A class representing a compiled statement. More...

#include <Statement.h>

Collaboration diagram for audacity::sqlite::Statement:
[legend]

Public Member Functions

 Statement (const Statement &)=delete
 
 Statement (Statement &&) noexcept
 
Statementoperator= (const Statement &)=delete
 
Statementoperator= (Statement &&) noexcept
 
RunContextPrepare () noexcept
 
template<typename... Args>
RunContextPrepare (Args &&... args)
 

Private Member Functions

 Statement (sqlite3_stmt *stmt)
 

Private Attributes

StatementHandlePtr mStatement {}
 
std::optional< RunContextmRunContext {}
 

Friends

class Connection
 

Detailed Description

A class representing a compiled statement.

The usage pattern is as follows:

  1. Create a Statement object using Connection::CreateStatement
  2. Prepare the statement using Statement::Prepare
  3. Bind the parameters using RunContext::Bind
  4. Execute the statement using RunContext::Run
  5. Iterate over the result set using RunResult::begin and RunResult::end

Definition at line 201 of file Statement.h.

Constructor & Destructor Documentation

◆ Statement() [1/3]

audacity::sqlite::Statement::Statement ( sqlite3_stmt *  stmt)
explicitprivate

Definition at line 40 of file Statement.cpp.

41 : mStatement { std::make_shared<StatementHandle>(stmt) }
42{
43}
StatementHandlePtr mStatement
Definition: Statement.h:222

◆ Statement() [2/3]

audacity::sqlite::Statement::Statement ( const Statement )
delete

◆ Statement() [3/3]

audacity::sqlite::Statement::Statement ( Statement &&  rhs)
noexcept

Definition at line 45 of file Statement.cpp.

46{
47 *this = std::move(rhs);
48}

Member Function Documentation

◆ operator=() [1/2]

Statement & audacity::sqlite::Statement::operator= ( const Statement )
delete

◆ operator=() [2/2]

Statement & audacity::sqlite::Statement::operator= ( Statement &&  rhs)
noexcept

Definition at line 50 of file Statement.cpp.

51{
52 std::swap(mStatement, rhs.mStatement);
53 return *this;
54}
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:634

References anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

◆ Prepare() [1/2]

RunContext & audacity::sqlite::Statement::Prepare ( )
noexcept

Definition at line 56 of file Statement.cpp.

57{
58 mRunContext = RunContext { mStatement };
59 return *mRunContext;
60}
std::optional< RunContext > mRunContext
Definition: Statement.h:223

References mRunContext, and mStatement.

◆ Prepare() [2/2]

template<typename... Args>
RunContext & audacity::sqlite::Statement::Prepare ( Args &&...  args)
inline

Definition at line 216 of file Statement.h.

217 {
218 return Prepare().BindAll(std::forward<Args>(args)...);
219 }
RunContext & BindAll(Args &&... args)
Definition: Statement.h:173
RunContext & Prepare() noexcept
Definition: Statement.cpp:56

References audacity::sqlite::RunContext::BindAll().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ Connection

friend class Connection
friend

Definition at line 225 of file Statement.h.

Member Data Documentation

◆ mRunContext

std::optional<RunContext> audacity::sqlite::Statement::mRunContext {}
private

Definition at line 223 of file Statement.h.

Referenced by Prepare().

◆ mStatement

StatementHandlePtr audacity::sqlite::Statement::mStatement {}
private

Definition at line 222 of file Statement.h.

Referenced by Prepare().


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