TrinityCore
Loading...
Searching...
No Matches
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 noexcept
 
uint8 GetUInt8 () const noexcept
 
int8 GetInt8 () const noexcept
 
uint16 GetUInt16 () const noexcept
 
int16 GetInt16 () const noexcept
 
uint32 GetUInt32 () const noexcept
 
int32 GetInt32 () const noexcept
 
uint64 GetUInt64 () const noexcept
 
int64 GetInt64 () const noexcept
 
float GetFloat () const noexcept
 
double GetDouble () const noexcept
 
SystemTimePoint GetDate () const noexcept
 
char const * GetCString () const noexcept
 
std::string GetString () const noexcept
 
std::string_view GetStringView () const noexcept
 
std::vector< uint8GetBinary () const noexcept
 
std::span< uint8 const > GetBinaryView () const noexcept
 
template<size_t S>
std::array< uint8, S > GetBinary () const noexcept
 
bool IsNull () const noexcept
 
Optional< uint8GetUInt8OrNull () const noexcept
 
Optional< int8GetInt8OrNull () const noexcept
 
Optional< uint16GetUInt16OrNull () const noexcept
 
Optional< int16GetInt16OrNull () const noexcept
 
Optional< uint32GetUInt32OrNull () const noexcept
 
Optional< int32GetInt32OrNull () const noexcept
 
Optional< uint64GetUInt64OrNull () const noexcept
 
Optional< int64GetInt64OrNull () const noexcept
 
Optional< float > GetFloatOrNull () const noexcept
 
Optional< double > GetDoubleOrNull () const noexcept
 
Optional< SystemTimePointGetDateOrNull () const noexcept
 
Optional< std::string > GetStringOrNull () const noexcept
 
Optional< std::string_view > GetStringViewOrNull () const noexcept
 
Optional< std::vector< uint8 > > GetBinaryOrNull () const noexcept
 
Optional< std::span< uint8 const > > GetBinaryViewOrNull () const noexcept
 
template<size_t S>
Optional< std::array< uint8, S > > GetBinaryOrNull () const noexcept
 

Private Member Functions

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

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 93 of file Field.h.

Constructor & Destructor Documentation

◆ Field()

Field::Field ( )

Definition at line 23 of file Field.cpp.

◆ ~Field()

Field::~Field ( )
default

Member Function Documentation

◆ GetBinary() [1/2]

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

Definition at line 125 of file Field.cpp.

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

◆ GetBinary() [2/2]

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

Definition at line 124 of file Field.h.

◆ GetBinaryOrNull() [1/2]

Optional< std::vector< uint8 > > Field::GetBinaryOrNull ( ) const
noexcept

Definition at line 227 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetBinaryOrNull() [2/2]

template<size_t S>
Optional< std::array< uint8, S > > Field::GetBinaryOrNull ( ) const
inlinenoexcept

Definition at line 152 of file Field.h.

◆ GetBinarySizeChecked()

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

Definition at line 241 of file Field.cpp.

◆ GetBinaryView()

std::span< uint8 const > Field::GetBinaryView ( ) const
noexcept

Definition at line 131 of file Field.cpp.

+ Here is the caller graph for this function:

◆ GetBinaryViewOrNull()

Optional< std::span< uint8 const > > Field::GetBinaryViewOrNull ( ) const
noexcept

Definition at line 234 of file Field.cpp.

+ Here is the caller graph for this function:

◆ GetBool()

bool Field::GetBool ( ) const
inlinenoexcept

Definition at line 102 of file Field.h.

+ Here is the caller graph for this function:

◆ GetCString()

char const * Field::GetCString ( ) const
noexcept

Definition at line 106 of file Field.cpp.

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

◆ GetDate()

SystemTimePoint Field::GetDate ( ) const
noexcept

Definition at line 99 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetDateOrNull()

Optional< SystemTimePoint > Field::GetDateOrNull ( ) const
noexcept

Definition at line 206 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetDouble()

double Field::GetDouble ( ) const
noexcept

Definition at line 92 of file Field.cpp.

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

◆ GetDoubleOrNull()

Optional< double > Field::GetDoubleOrNull ( ) const
noexcept

Definition at line 199 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetFloat()

float Field::GetFloat ( ) const
noexcept

Definition at line 85 of file Field.cpp.

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

◆ GetFloatOrNull()

Optional< float > Field::GetFloatOrNull ( ) const
noexcept

Definition at line 192 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
noexcept

Definition at line 50 of file Field.cpp.

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

◆ GetInt16OrNull()

Optional< int16 > Field::GetInt16OrNull ( ) const
noexcept

Definition at line 157 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetInt32()

int32 Field::GetInt32 ( ) const
noexcept

Definition at line 64 of file Field.cpp.

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

◆ GetInt32OrNull()

Optional< int32 > Field::GetInt32OrNull ( ) const
noexcept

Definition at line 171 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
noexcept

Definition at line 78 of file Field.cpp.

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

◆ GetInt64OrNull()

Optional< int64 > Field::GetInt64OrNull ( ) const
noexcept

Definition at line 185 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetInt8()

int8 Field::GetInt8 ( ) const
noexcept

Definition at line 36 of file Field.cpp.

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

◆ GetInt8OrNull()

Optional< int8 > Field::GetInt8OrNull ( ) const
noexcept

Definition at line 143 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetString()

std::string Field::GetString ( ) const
noexcept

Definition at line 113 of file Field.cpp.

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

◆ GetStringOrNull()

Optional< std::string > Field::GetStringOrNull ( ) const
noexcept

Definition at line 213 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetStringView()

std::string_view Field::GetStringView ( ) const
noexcept

Definition at line 118 of file Field.cpp.

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

◆ GetStringViewOrNull()

Optional< std::string_view > Field::GetStringViewOrNull ( ) const
noexcept

Definition at line 220 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
noexcept

Definition at line 43 of file Field.cpp.

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

◆ GetUInt16OrNull()

Optional< uint16 > Field::GetUInt16OrNull ( ) const
noexcept

Definition at line 150 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
noexcept

Definition at line 57 of file Field.cpp.

+ Here is the call graph for this function:

◆ GetUInt32OrNull()

Optional< uint32 > Field::GetUInt32OrNull ( ) const
noexcept

Definition at line 164 of file Field.cpp.

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

◆ GetUInt64()

uint64 Field::GetUInt64 ( ) const
noexcept

Definition at line 71 of file Field.cpp.

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

◆ GetUInt64OrNull()

Optional< uint64 > Field::GetUInt64OrNull ( ) const
noexcept

Definition at line 178 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
noexcept

Definition at line 29 of file Field.cpp.

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

◆ GetUInt8OrNull()

Optional< uint8 > Field::GetUInt8OrNull ( ) const
noexcept

Definition at line 136 of file Field.cpp.

+ Here is the call graph for this function:

◆ IsNull()

bool Field::IsNull ( ) const
inlinenoexcept

Definition at line 131 of file Field.h.

+ Here is the caller graph for this function:

◆ SetMetadata()

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

Definition at line 254 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 247 of file Field.cpp.

Friends And Related Symbol Documentation

◆ PreparedResultSet

friend class PreparedResultSet
friend

Definition at line 96 of file Field.h.

◆ ResultSet

friend class ResultSet
friend

Definition at line 95 of file Field.h.

Member Data Documentation

◆ _length

uint32 Field::_length
private

Definition at line 162 of file Field.h.

◆ _meta

QueryResultFieldMetadata const* Field::_meta
private

Definition at line 166 of file Field.h.

◆ _value

char const* Field::_value
private

Definition at line 161 of file Field.h.


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