TrinityCore
Loading...
Searching...
No Matches
PreparedResultSet Class Reference

#include <QueryResult.h>

Public Member Functions

 PreparedResultSet (MySQLStmt *stmt, MySQLResult *result, uint64 rowCount, uint32 fieldCount)
 
 ~PreparedResultSet ()
 
bool NextRow ()
 
uint64 GetRowCount () const
 
uint32 GetFieldCount () const
 
Field * Fetch () const
 
Field const & operator[] (std::size_t index) const
 
Field const & operator[] (Trinity::DB::FieldLookupByAliasKey const &alias) const
 
QueryResultFieldMetadata const & GetFieldMetadata (std::size_t index) const
 
QueryResultFieldMetadata const & GetFieldMetadata (Trinity::DB::FieldLookupByAliasKey const &alias) const
 

Protected Attributes

std::vector< QueryResultFieldMetadata > m_fieldMetadata
 
Trinity::DB::FieldAliasToIndexMap m_fieldIndexByAlias
 
std::vector< Field > m_rows
 
uint64 m_rowCount
 
uint64 m_rowPosition
 
uint32 m_fieldCount
 

Private Member Functions

void CleanUp ()
 
bool _NextRow ()
 
 PreparedResultSet (PreparedResultSet const &right)=delete
 
PreparedResultSet & operator= (PreparedResultSet const &right)=delete
 

Private Attributes

MySQLBind * m_rBind
 
MySQLStmt * m_stmt
 
MySQLResult * m_metadataResult
 Field metadata, returned by mysql_stmt_result_metadata.
 

Detailed Description

Definition at line 83 of file QueryResult.h.

Constructor & Destructor Documentation

◆ PreparedResultSet() [1/2]

PreparedResultSet::PreparedResultSet ( MySQLStmt *  stmt,
MySQLResult *  result,
uint64  rowCount,
uint32  fieldCount 
)

◆ ~PreparedResultSet()

PreparedResultSet::~PreparedResultSet ( )

Definition at line 556 of file QueryResult.cpp.

References CleanUp().

◆ PreparedResultSet() [2/2]

PreparedResultSet::PreparedResultSet ( PreparedResultSet const &  right)
privatedelete

Member Function Documentation

◆ _NextRow()

bool PreparedResultSet::_NextRow ( )
private

Only called in low-level code, namely the constructor Will iterate over every row of data and buffer it

Definition at line 597 of file QueryResult.cpp.

References m_rowCount, m_rowPosition, and m_stmt.

Referenced by PreparedResultSet().

◆ CleanUp()

void PreparedResultSet::CleanUp ( )
private

Definition at line 623 of file QueryResult.cpp.

References m_metadataResult, and m_rBind.

Referenced by PreparedResultSet(), and ~PreparedResultSet().

◆ Fetch()

Field * PreparedResultSet::Fetch ( ) const

◆ GetFieldCount()

uint32 PreparedResultSet::GetFieldCount ( ) const
inline

Definition at line 91 of file QueryResult.h.

◆ GetFieldMetadata() [1/2]

QueryResultFieldMetadata const & PreparedResultSet::GetFieldMetadata ( std::size_t  index) const

Definition at line 683 of file QueryResult.cpp.

References ASSERT, m_fieldCount, and m_fieldMetadata.

◆ GetFieldMetadata() [2/2]

QueryResultFieldMetadata const & PreparedResultSet::GetFieldMetadata ( Trinity::DB::FieldLookupByAliasKey const &  alias) const

Definition at line 689 of file QueryResult.cpp.

References ASSERT, m_fieldIndexByAlias, and m_fieldMetadata.

◆ GetRowCount()

uint64 PreparedResultSet::GetRowCount ( ) const
inline

◆ NextRow()

bool PreparedResultSet::NextRow ( )

Only updates the m_rowPosition so upper level code knows in which element of the rows vector to look

Definition at line 587 of file QueryResult.cpp.

References m_rowCount, and m_rowPosition.

◆ operator=()

PreparedResultSet & PreparedResultSet::operator= ( PreparedResultSet const &  right)
privatedelete

◆ operator[]() [1/2]

Field const & PreparedResultSet::operator[] ( std::size_t  index) const

Definition at line 668 of file QueryResult.cpp.

References ASSERT, m_fieldCount, m_rowCount, m_rowPosition, and m_rows.

◆ operator[]() [2/2]

Field const & PreparedResultSet::operator[] ( Trinity::DB::FieldLookupByAliasKey const &  alias) const

Definition at line 675 of file QueryResult.cpp.

References ASSERT, m_fieldCount, m_fieldIndexByAlias, m_rowCount, m_rowPosition, and m_rows.

Member Data Documentation

◆ m_fieldCount

uint32 PreparedResultSet::m_fieldCount
protected

Definition at line 106 of file QueryResult.h.

Referenced by Fetch(), GetFieldMetadata(), operator[](), operator[](), and PreparedResultSet().

◆ m_fieldIndexByAlias

Trinity::DB::FieldAliasToIndexMap PreparedResultSet::m_fieldIndexByAlias
protected

Definition at line 102 of file QueryResult.h.

Referenced by GetFieldMetadata(), operator[](), and PreparedResultSet().

◆ m_fieldMetadata

std::vector<QueryResultFieldMetadata> PreparedResultSet::m_fieldMetadata
protected

Definition at line 101 of file QueryResult.h.

Referenced by GetFieldMetadata(), GetFieldMetadata(), and PreparedResultSet().

◆ m_metadataResult

MySQLResult* PreparedResultSet::m_metadataResult
private

Field metadata, returned by mysql_stmt_result_metadata.

Definition at line 111 of file QueryResult.h.

Referenced by CleanUp(), and PreparedResultSet().

◆ m_rBind

MySQLBind* PreparedResultSet::m_rBind
private

Definition at line 109 of file QueryResult.h.

Referenced by CleanUp(), and PreparedResultSet().

◆ m_rowCount

uint64 PreparedResultSet::m_rowCount
protected

Definition at line 104 of file QueryResult.h.

Referenced by _NextRow(), Fetch(), NextRow(), operator[](), operator[](), and PreparedResultSet().

◆ m_rowPosition

uint64 PreparedResultSet::m_rowPosition
protected

Definition at line 105 of file QueryResult.h.

Referenced by _NextRow(), Fetch(), NextRow(), operator[](), operator[](), and PreparedResultSet().

◆ m_rows

std::vector<Field> PreparedResultSet::m_rows
protected

Definition at line 103 of file QueryResult.h.

Referenced by Fetch(), operator[](), operator[](), and PreparedResultSet().

◆ m_stmt

MySQLStmt* PreparedResultSet::m_stmt
private

Definition at line 110 of file QueryResult.h.

Referenced by _NextRow(), and PreparedResultSet().


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