OregonCore  revision be9e804-git
Your Favourite TBC server
SqlQueryHolderEx Class Reference

#include <SqlOperations.h>

+ Inheritance diagram for SqlQueryHolderEx:

Public Member Functions

 SqlQueryHolderEx (SqlQueryHolder *holder, Oregon::IQueryCallback *callback, SqlResultQueue *queue)
 
void Execute (Database *db)
 
- Public Member Functions inherited from SqlOperation
virtual void OnRemove ()
 
virtual ~SqlOperation ()
 

Private Attributes

SqlQueryHolderm_holder
 
Oregon::IQueryCallbackm_callback
 
SqlResultQueuem_queue
 

Detailed Description

Definition at line 190 of file SqlOperations.h.

Constructor & Destructor Documentation

SqlQueryHolderEx::SqlQueryHolderEx ( SqlQueryHolder holder,
Oregon::IQueryCallback callback,
SqlResultQueue queue 
)
inline

Definition at line 197 of file SqlOperations.h.

References SqlOperation::Execute().

198  : m_holder(holder), m_callback(callback), m_queue(queue) {}
SqlResultQueue * m_queue
Oregon::IQueryCallback * m_callback
SqlQueryHolder * m_holder

Member Function Documentation

void SqlQueryHolderEx::Execute ( Database db)
virtual

Implements SqlOperation.

Definition at line 151 of file SqlOperations.cpp.

References Database::Query().

152 {
153  if (!m_holder || !m_callback || !m_queue)
154  return;
155 
156  // we can do this, we are friends
157  std::vector<SqlQueryHolder::SqlResultPair>& queries = m_holder->m_queries;
158 
159  for (size_t i = 0; i < queries.size(); i++)
160  {
161  // execute all queries in the holder and pass the results
162  char const* sql = queries[i].first;
163  if (sql) m_holder->SetResult(i, db->Query(sql));
164  }
165 
166  // sync with the caller thread
168 }
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
void SetResult(size_t index, QueryResult_AutoPtr result)
SqlResultQueue * m_queue
void add(const T &item)
Definition: LockedQueue.h:55
Oregon::IQueryCallback * m_callback
std::vector< SqlResultPair > m_queries
SqlQueryHolder * m_holder

Member Data Documentation

Oregon::IQueryCallback* SqlQueryHolderEx::m_callback
private

Definition at line 194 of file SqlOperations.h.

SqlQueryHolder* SqlQueryHolderEx::m_holder
private

Definition at line 193 of file SqlOperations.h.

SqlResultQueue* SqlQueryHolderEx::m_queue
private

Definition at line 195 of file SqlOperations.h.


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