AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SQLQueryHolderTask Class Reference

#include "QueryHolder.h"

Inheritance diagram for SQLQueryHolderTask:
SQLOperation

Public Member Functions

 SQLQueryHolderTask (std::shared_ptr< SQLQueryHolderBase > holder)
 
 ~SQLQueryHolderTask ()
 
bool Execute () override
 
QueryResultHolderFuture GetFuture ()
 
- Public Member Functions inherited from SQLOperation
 SQLOperation ()=default
 
virtual ~SQLOperation ()=default
 
virtual int call ()
 
virtual bool Execute ()=0
 
virtual void SetConnection (MySQLConnection *con)
 

Private Attributes

std::shared_ptr< SQLQueryHolderBasem_holder
 
QueryResultHolderPromise m_result
 

Additional Inherited Members

- Public Attributes inherited from SQLOperation
MySQLConnectionm_conn {nullptr}
 

Detailed Description

Constructor & Destructor Documentation

◆ SQLQueryHolderTask()

SQLQueryHolderTask::SQLQueryHolderTask ( std::shared_ptr< SQLQueryHolderBase holder)
inlineexplicit
56 : m_holder(std::move(holder)) { }
std::shared_ptr< SQLQueryHolderBase > m_holder
Definition: QueryHolder.h:64

◆ ~SQLQueryHolderTask()

SQLQueryHolderTask::~SQLQueryHolderTask ( )
default

Member Function Documentation

◆ Execute()

bool SQLQueryHolderTask::Execute ( )
overridevirtual

execute all queries in the holder and pass the results

Implements SQLOperation.

78{
80 for (std::size_t i = 0; i < m_holder->m_queries.size(); ++i)
81 if (PreparedStatementBase* stmt = m_holder->m_queries[i].first)
82 m_holder->SetPreparedResult(i, m_conn->Query(stmt));
83
84 m_result.set_value();
85 return true;
86}
ResultSet * Query(std::string_view sql)
Definition: MySQLConnection.cpp:311
Definition: PreparedStatement.h:69
QueryResultHolderPromise m_result
Definition: QueryHolder.h:65
MySQLConnection * m_conn
Definition: SQLOperation.h:56

References SQLOperation::m_conn, m_holder, m_result, and MySQLConnection::Query().

◆ GetFuture()

QueryResultHolderFuture SQLQueryHolderTask::GetFuture ( )
inline
61{ return m_result.get_future(); }

Referenced by DatabaseWorkerPool< T >::DelayQueryHolder().

Member Data Documentation

◆ m_holder

std::shared_ptr<SQLQueryHolderBase> SQLQueryHolderTask::m_holder
private

Referenced by Execute().

◆ m_result

QueryResultHolderPromise SQLQueryHolderTask::m_result
private

Referenced by Execute().