TrinityCore
Field Class Reference

Class used to access individual fields of database query result. More...

#include <Field.h>

Public Member Functions

 Field ()
 
 ~Field ()
 
bool GetBool () const
 
uint8 GetUInt8 () const
 
int8 GetInt8 () const
 
uint16 GetUInt16 () const
 
int16 GetInt16 () const
 
uint32 GetUInt32 () const
 
int32 GetInt32 () const
 
uint64 GetUInt64 () const
 
int64 GetInt64 () const
 
float GetFloat () const
 
double GetDouble () const
 
char const * GetCString () const
 
std::string GetString () const
 
std::string_view GetStringView () const
 
std::vector< uint8GetBinary () const
 
template<size_t S>
std::array< uint8, S > GetBinary () const
 
bool IsNull () const
 

Private Member Functions

void SetValue (char const *newValue, uint32 length)
 
void SetMetadata (QueryResultFieldMetadata const *meta)
 
void GetBinarySizeChecked (uint8 *buf, size_t size) const
 

Private Attributes

char const * _value
 
uint32 _length
 
QueryResultFieldMetadata const * _meta
 

Friends

class ResultSet
 
class PreparedResultSet
 

Detailed Description

Class used to access individual fields of database query result.

Guideline on field type matching:

MySQL type method to use
TINYINT GetBool, GetInt8, GetUInt8
SMALLINT GetInt16, GetUInt16
MEDIUMINT, INT GetInt32, GetUInt32
BIGINT GetInt64, GetUInt64
FLOAT GetFloat
DOUBLE, DECIMAL GetDouble
CHAR, VARCHAR, GetCString, GetString
TINYTEXT, MEDIUMTEXT, GetCString, GetString
TEXT, LONGTEXT GetCString, GetString
TINYBLOB, MEDIUMBLOB, GetBinary, GetString
BLOB, LONGBLOB GetBinary, GetString
BINARY, VARBINARY GetBinary

Return types of aggregate functions:

Function Type
MIN, MAX Same as the field
SUM, AVG DECIMAL
COUNT BIGINT

Definition at line 89 of file Field.h.

Constructor & Destructor Documentation

◆ Field()

Field::Field ( )

Definition at line 24 of file Field.cpp.

◆ ~Field()

Field::~Field ( )
default

Member Function Documentation

◆ GetBinary() [1/2]

std::vector< uint8 > Field::GetBinary ( ) const

Definition at line 142 of file Field.cpp.

+ Here is the caller graph for this function:

◆ GetBinary() [2/2]

template<size_t S>
std::array< uint8, S > Field::GetBinary ( ) const
inline

Definition at line 118 of file Field.h.

◆ GetBinarySizeChecked()

void Field::GetBinarySizeChecked ( uint8 buf,
size_t  size 
) const
private

Definition at line 153 of file Field.cpp.

◆ GetBool()

bool Field::GetBool ( ) const
inline

Definition at line 98 of file Field.h.

+ Here is the caller graph for this function:

◆ GetCString()

char const * Field::GetCString ( ) const

Definition at line 110 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDouble()

double Field::GetDouble ( ) const

Definition at line 102 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetFloat()

float Field::GetFloat ( ) const

Definition at line 94 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt16()

int16 Field::GetInt16 ( ) const

Definition at line 54 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt32()

int32 Field::GetInt32 ( ) const

Definition at line 70 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt64()

int64 Field::GetInt64 ( ) const

Definition at line 86 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt8()

int8 Field::GetInt8 ( ) const

Definition at line 38 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetString()

std::string Field::GetString ( ) const

Definition at line 118 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStringView()

std::string_view Field::GetStringView ( ) const

Definition at line 130 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetUInt16()

uint16 Field::GetUInt16 ( ) const

Definition at line 46 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetUInt32()

uint32 Field::GetUInt32 ( ) const

Definition at line 62 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetUInt64()

uint64 Field::GetUInt64 ( ) const

Definition at line 78 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetUInt8()

uint8 Field::GetUInt8 ( ) const

Definition at line 30 of file Field.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsNull()

bool Field::IsNull ( ) const
inline

Definition at line 125 of file Field.h.

+ Here is the caller graph for this function:

◆ SetMetadata()

void Field::SetMetadata ( QueryResultFieldMetadata const *  meta)
private

Definition at line 166 of file Field.cpp.

+ Here is the caller graph for this function:

◆ SetValue()

void Field::SetValue ( char const *  newValue,
uint32  length 
)
private

Definition at line 159 of file Field.cpp.

Friends And Related Function Documentation

◆ PreparedResultSet

friend class PreparedResultSet
friend

Definition at line 92 of file Field.h.

◆ ResultSet

friend class ResultSet
friend

Definition at line 91 of file Field.h.

Member Data Documentation

◆ _length

uint32 Field::_length
private

Definition at line 132 of file Field.h.

◆ _meta

QueryResultFieldMetadata const* Field::_meta
private

Definition at line 136 of file Field.h.

◆ _value

char const* Field::_value
private

Definition at line 131 of file Field.h.


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