AzerothCore 3.3.5a
OpenSource WoW Emulator
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 ()=default
 
bool IsNull () const
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, T > Get () const
 
template<typename T >
std::enable_if_t< std::is_same_v< std::string, T >, T > Get () const
 
template<typename T >
std::enable_if_t< std::is_same_v< std::string_view, T >, T > Get () const
 
template<typename T >
std::enable_if_t< std::is_same_v< Binary, T >, T > Get () const
 
template<typename T , std::size_t S>
std::enable_if_t< std::is_same_v< Binary, T >, std::array< uint8, S > > Get () const
 
template<typename T >
Acore::Types::is_chrono_v< T > Get (bool convertToUin32=true) const
 
DatabaseFieldTypes GetType ()
 

Protected Member Functions

void SetByteValue (char const *newValue, uint32 length)
 
void SetStructuredValue (char const *newValue, uint32 length)
 
bool IsType (DatabaseFieldTypes type) const
 
bool IsNumeric () const
 

Protected Attributes

struct {
   char const *   value
 
   uint32   length
 
   bool   raw
 
data
 

Private Member Functions

template<typename T >
GetData () const
 
std::string GetDataString () const
 
std::string_view GetDataStringView () const
 
Binary GetDataBinary () const
 
void LogWrongType (std::string_view getter, std::string_view typeName) const
 
void SetMetadata (QueryResultFieldMetadata const *fieldMeta)
 
void GetBinarySizeChecked (uint8 *buf, std::size_t size) const
 

Private Attributes

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 Get<bool>, Get<int8>, Get<uint8>
SMALLINT Get<int16>, Get<uint16>
MEDIUMINT, INT Get<int32>, Get<uint32>
BIGINT Get<int64>, Get<uint64>
FLOAT Get<float>
DOUBLE, DECIMAL Get<double>
CHAR, VARCHAR, Get<std::string>, Get<std::string_view>
TINYTEXT, MEDIUMTEXT, Get<std::string>, Get<std::string_view>
TEXT, LONGTEXT Get<std::string>, Get<std::string_view>
TINYBLOB, MEDIUMBLOB, Get<Binary>, Get<std::string>
BLOB, LONGBLOB Get<Binary>, Get<std::string>
BINARY, VARBINARY Get<Binary>

Return types of aggregate functions:

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

Constructor & Destructor Documentation

◆ Field()

Field::Field ( )
26{
27 data.value = nullptr;
28 data.length = 0;
29 data.raw = false;
30 meta = nullptr;
31}
struct Field::@1 data
QueryResultFieldMetadata const * meta
Definition: Field.h:173

References data, and meta.

◆ ~Field()

Field::~Field ( )
default

Member Function Documentation

◆ Get() [1/6]

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, T > Field::Get ( ) const
inline
114 {
115 return GetData<T>();
116 }

Referenced by Player::_LoadActions(), Pet::_LoadAuras(), Player::_LoadAuras(), Player::_LoadBrewOfTheMonth(), Player::_LoadCharacterSettings(), Player::_LoadDailyQuestStatus(), Player::_LoadEntryPointData(), Player::_LoadEquipmentSets(), lfg::LFGMgr::_LoadFromDB(), Player::_LoadGlyphs(), Player::_LoadHomeBind(), Player::_LoadInventory(), Player::_LoadItem(), Player::_LoadMail(), Player::_LoadMailedItem(), Player::_LoadMonthlyQuestStatus(), Player::_LoadPetStable(), Player::_LoadQuestStatus(), Player::_LoadQuestStatusRewarded(), Player::_LoadSeasonalQuestStatus(), Player::_LoadSkills(), Pet::_LoadSpellCooldowns(), Player::_LoadSpellCooldowns(), Player::_LoadWeeklyQuestStatus(), World::_UpdateRealmCharCount(), AccountInfo::AccountInfo(), Guild::AddMember(), AppendTableDump(), SecretMgr::AttemptTransition(), BanMgr::BanIP(), Player::BuildEnumData(), CharacterDatabaseCleaner::CheckUnique(), Player::DeleteFromDB(), Player::DeleteOldRecoveryItems(), npc_shattrath_daily_quest::DoAction(), Battleground::EndBattleground(), character_commandscript::GetDeletedCharacterInfoList(), Player::GetZoneIdFromDB(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccountOnlineListCommand(), ban_commandscript::HandleBanInfoCharacterCommand(), ban_commandscript::HandleBanInfoHelper(), ban_commandscript::HandleBanInfoIPCommand(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), WorldSession::HandleCharacterAuraFrozen(), WorldSession::HandleCharCustomizeCallback(), WorldSession::HandleCharFactionOrRaceChangeCallback(), WorldSession::HandleCharRenameCallBack(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), gobject_commandscript::HandleGameObjectNearCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), gear_commandscript::HandleGearStatsCommand(), gm_commandscript::HandleGMListFullCommand(), item_commandscript::HandleItemRefundCommand(), item_commandscript::HandleItemRestoreListCommand(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListItemCommand(), list_commandscript::HandleListObjectCommand(), npc_commandscript::HandleNpcNearCommand(), WorldSession::HandleOpenWrappedItemCallback(), misc_commandscript::HandlePInfoCommand(), quest_commandscript::HandleQuestComplete(), server_commandscript::HandleServerDebugCommand(), tele_commandscript::HandleTeleNameCommand(), tele_commandscript::HandleTeleNameNpcNameCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleWhoisOpcode(), wp_commandscript::HandleWpEventCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), GameEventMgr::Initialize(), Player::LeaveAllArenaTeams(), WaypointMgr::Load(), DBCDatabaseLoader::Load(), ObjectMgr::LoadAccessRequirements(), WorldSession::LoadAccountData(), AchievementGlobalMgr::LoadAchievementCriteriaData(), ObjectMgr::LoadAcoreStrings(), ObjectMgr::LoadAreaTriggers(), ObjectMgr::LoadAreaTriggerScripts(), ObjectMgr::LoadAreaTriggerTeleports(), ArenaTeam::LoadArenaTeamFromDB(), AuctionHouseMgr::LoadAuctionItems(), AutobroadcastMgr::LoadAutobroadcasts(), Guild::LoadBankEventLogFromDB(), Guild::LoadBankItemFromDB(), Guild::LoadBankTabFromDB(), BattlegroundMgr::LoadBattlegroundTemplates(), BattlegroundMgr::LoadBattleMastersEntry(), ObjectMgr::LoadBroadcastTextLocales(), ObjectMgr::LoadBroadcastTexts(), ChannelMgr::LoadChannelRights(), ChannelMgr::LoadChannels(), InstanceSaveMgr::LoadCharacterBinds(), Acore::Impl::ChatCommands::ChatCommandNode::LoadCommandMap(), AchievementGlobalMgr::LoadCompletedAchievements(), ConditionMgr::LoadConditions(), Map::LoadCorpseData(), Corpse::LoadCorpseFromDB(), ObjectMgr::LoadCreatureAddons(), ObjectMgr::LoadCreatureClassLevelStats(), FormationMgr::LoadCreatureFormations(), ObjectMgr::LoadCreatureLocales(), ObjectMgr::LoadCreatureModelInfo(), ObjectMgr::LoadCreatureMovementOverrides(), ObjectMgr::LoadCreatureQuestItems(), ObjectMgr::LoadCreatures(), ObjectMgr::LoadCreatureTemplate(), ObjectMgr::LoadCreatureTemplateAddons(), ObjectMgr::LoadCreatureTemplateModels(), ObjectMgr::LoadCreatureTemplateResistances(), ObjectMgr::LoadCreatureTemplateSpells(), CreatureTextMgr::LoadCreatureTextLocales(), CreatureTextMgr::LoadCreatureTexts(), World::LoadDBVersion(), DisableMgr::LoadDisables(), ObjectMgr::LoadEquipmentTemplates(), ObjectMgr::LoadExplorationBaseXP(), ObjectMgr::LoadFactionChangeAchievements(), ObjectMgr::LoadFactionChangeItems(), ObjectMgr::LoadFactionChangeQuests(), ObjectMgr::LoadFactionChangeReputations(), ObjectMgr::LoadFactionChangeSpells(), ObjectMgr::LoadFactionChangeTitles(), ObjectMgr::LoadFishingBaseSkillLevel(), AddonMgr::LoadFromDB(), SmartWaypointMgr::LoadFromDB(), CalendarMgr::LoadFromDB(), GameEventMgr::LoadFromDB(), PoolMgr::LoadFromDB(), AuctionEntry::LoadFromDB(), EmblemInfo::LoadFromDB(), Guild::Member::LoadFromDB(), Guild::RankInfo::LoadFromDB(), Guild::BankTab::LoadFromDB(), Guild::LoadFromDB(), GmTicket::LoadFromDB(), Player::LoadFromDB(), Item::LoadFromDB(), AchievementMgr::LoadFromDB(), ReputationMgr::LoadFromDB(), SocialMgr::LoadFromDB(), ObjectMgr::LoadGameObjectAddons(), ObjectMgr::LoadGameObjectLocales(), ObjectMgr::LoadGameObjectQuestItems(), ObjectMgr::LoadGameobjects(), ObjectMgr::LoadGameObjectTemplate(), ObjectMgr::LoadGameObjectTemplateAddons(), ObjectMgr::LoadGameTele(), ObjectMgr::LoadGossipMenu(), ObjectMgr::LoadGossipMenuItems(), ObjectMgr::LoadGossipMenuItemsLocales(), ObjectMgr::LoadGossipText(), Graveyard::LoadGraveyardFromDB(), Graveyard::LoadGraveyardZones(), Group::LoadGroupFromDB(), GuildMgr::LoadGuilds(), GameEventMgr::LoadHolidayDates(), ObjectMgr::LoadInstanceEncounters(), InstanceSaveMgr::LoadInstanceSaves(), ObjectMgr::LoadInstanceTemplate(), Guild::BankTab::LoadItemFromDB(), ObjectMgr::LoadItemLocales(), ObjectMgr::LoadItemSetNameLocales(), ObjectMgr::LoadItemSetNames(), ObjectMgr::LoadItemTemplates(), lfg::LFGMgr::LoadLFGDungeons(), ObjectMgr::LoadLinkedRespawn(), LootStore::LoadLootTable(), ObjectMgr::LoadMailLevelRewards(), ObjectMgr::LoadMailServerTemplates(), Guild::LoadMemberFromDB(), ArenaTeam::LoadMembersFromDB(), ObjectMgr::LoadModuleStrings(), ObjectMgr::LoadModuleStringsLocale(), MotdMgr::LoadMotd(), ObjectMgr::LoadNPCSpellClickSpells(), ObjectMgr::LoadNpcTextLocales(), ObjectMgr::LoadPageTextLocales(), ObjectMgr::LoadPageTexts(), Pet::LoadPetFromDB(), ObjectMgr::LoadPetLevelInfo(), ObjectMgr::LoadPetNames(), ObjectMgr::LoadPetNamesLocales(), ObjectMgr::LoadPetNumber(), ObjectMgr::LoadPlayerInfo(), ObjectMgr::LoadPointOfInterestLocales(), ObjectMgr::LoadPointsOfInterest(), Player::LoadPositionFromDB(), ObjectMgr::LoadProfanityNamesFromDB(), ObjectMgr::LoadQuestAreaTriggers(), ObjectMgr::LoadQuestGreetings(), ObjectMgr::LoadQuestGreetingsLocales(), ObjectMgr::LoadQuestLocales(), ObjectMgr::LoadQuestMoneyRewards(), Quest::LoadQuestOfferReward(), ObjectMgr::LoadQuestOfferRewardLocale(), ObjectMgr::LoadQuestPOI(), Quest::LoadQuestRequestItems(), ObjectMgr::LoadQuestRequestItemsLocale(), ObjectMgr::LoadQuests(), Quest::LoadQuestTemplateAddon(), LoadRandomEnchantmentsTable(), LoadRealmInfo(), ObjectMgr::LoadReferenceVendor(), ObjectMgr::LoadReputationOnKill(), ObjectMgr::LoadReputationRewardRate(), ObjectMgr::LoadReputationSpilloverTemplate(), ObjectMgr::LoadReservedPlayerNamesDB(), InstanceSaveMgr::LoadResetTimes(), Map::LoadRespawnTimes(), AccountInfo::LoadResult(), AchievementGlobalMgr::LoadRewardLocales(), AchievementGlobalMgr::LoadRewards(), lfg::LFGMgr::LoadRewards(), ObjectMgr::LoadScripts(), SystemMgr::LoadScriptWaypoints(), LoadSkillDiscoveryTable(), LoadSkillExtraItemTable(), LoadSkillPerfectItemTable(), SmartAIMgr::LoadSmartAIFromDB(), SpellMgr::LoadSpellAreas(), SpellMgr::LoadSpellBonuses(), SpellMgr::LoadSpellCooldownOverrides(), SpellMgr::LoadSpellEnchantProcData(), SpellMgr::LoadSpellGroups(), SpellMgr::LoadSpellGroupStackRules(), SpellMgr::LoadSpellInfoCustomAttributes(), SpellMgr::LoadSpellLinked(), SpellMgr::LoadSpellMixology(), SpellMgr::LoadSpellPetAuras(), SpellMgr::LoadSpellProcEvents(), SpellMgr::LoadSpellProcs(), SpellMgr::LoadSpellRanks(), SpellMgr::LoadSpellRequired(), ObjectMgr::LoadSpellScriptNames(), SpellMgr::LoadSpellTargetPositions(), SpellMgr::LoadSpellThreats(), ObjectMgr::LoadTavernAreaTriggers(), ObjectMgr::LoadTempSummons(), ObjectMgr::LoadTrainerSpell(), TransportMgr::LoadTransportTemplates(), ObjectMgr::LoadVehicleAccessories(), ObjectMgr::LoadVehicleTemplateAccessories(), ObjectMgr::LoadVendors(), WardenCheckMgr::LoadWardenChecks(), WardenCheckMgr::LoadWardenOverrides(), ObjectMgr::LoadWaypointScripts(), WeatherMgr::LoadWeatherData(), World::LoadWorldStates(), AuthSession::LogonChallengeCallback(), lookup_commandscript::LookupPlayerSearchCommand(), Quest::Quest(), AuthSession::RealmListCallback(), UpdateFetcher::ReceiveAppliedFiles(), UpdateFetcher::ReceiveIncludedDirectories(), AuthSession::ReconnectChallengeCallback(), WaypointMgr::ReloadPath(), ObjectMgr::ReturnOrDeleteOldMails(), TransportMgr::SpawnContinentTransports(), and GameEventMgr::StartArenaSeason().

◆ Get() [2/6]

template<typename T >
std::enable_if_t< std::is_same_v< std::string, T >, T > Field::Get ( ) const
inline
120 {
121 return GetDataString();
122 }
std::string GetDataString() const
Definition: Field.cpp:290

◆ Get() [3/6]

template<typename T >
std::enable_if_t< std::is_same_v< std::string_view, T >, T > Field::Get ( ) const
inline
126 {
127 return GetDataStringView();
128 }
std::string_view GetDataStringView() const
Definition: Field.cpp:306

◆ Get() [4/6]

template<typename T >
std::enable_if_t< std::is_same_v< Binary, T >, T > Field::Get ( ) const
inline
132 {
133 return GetDataBinary();
134 }
Binary GetDataBinary() const
Definition: Field.cpp:322

◆ Get() [5/6]

template<typename T , std::size_t S>
std::enable_if_t< std::is_same_v< Binary, T >, std::array< uint8, S > > Field::Get ( ) const
inline
138 {
139 std::array<uint8, S> buf = {};
140 GetBinarySizeChecked(buf.data(), S);
141 return buf;
142 }
void GetBinarySizeChecked(uint8 *buf, std::size_t size) const
Definition: Field.cpp:147

◆ Get() [6/6]

template<typename T >
Acore::Types::is_chrono_v< T > Field::Get ( bool  convertToUin32 = true) const
inline
146 {
147 return convertToUin32 ? T(GetData<uint32>()) : T(GetData<uint64>());
148 }
std::uint64_t uint64
Definition: Define.h:106
T GetData() const
Definition: Field.cpp:196

◆ GetBinarySizeChecked()

void Field::GetBinarySizeChecked ( uint8 buf,
std::size_t  size 
) const
private
148{
149 ASSERT(data.value && (data.length == length), "Expected {}-byte binary blob, got {}data ({} bytes) instead", length, data.value ? "" : "no ", data.length);
150 memcpy(buf, data.value, length);
151}
#define ASSERT
Definition: Errors.h:68
uint32 length
Definition: Field.h:156

References ASSERT, data, and length.

◆ GetData()

template<typename T >
template double Field::GetData ( ) const
private
197{
198 static_assert(std::is_arithmetic_v<T>, "Unsurropt type for Field::GetData()");
199
200 if (!data.value)
201 return GetDefaultValue<T>();
202
203#ifdef ACORE_STRICT_DATABASE_TYPE_CHECKS
204 if (!IsCorrectFieldType<T>(meta->Type))
205 {
206 LogWrongType(__FUNCTION__, typeid(T).name());
207 //return GetDefaultValue<T>();
208 }
209#endif
210
211 Optional<T> result = {};
212
213 if (data.raw)
214 result = *reinterpret_cast<T const*>(data.value);
215 else
216 result = Acore::StringTo<T>(data.value);
217
218 // Correct double fields... this undefined behavior :/
219 if constexpr (std::is_same_v<T, double>)
220 {
221 if (data.raw && !IsType(DatabaseFieldTypes::Decimal))
222 result = *reinterpret_cast<double const*>(data.value);
223 else
224 result = Acore::StringTo<float>(data.value);
225 }
226
227 // Check -1 for *_dbc db tables
228 if constexpr (std::is_same_v<T, uint32>)
229 {
230 std::string_view tableName{ meta->TableName };
231
232 if (!tableName.empty() && tableName.size() > 4)
233 {
234 auto signedResult = Acore::StringTo<int32>(data.value);
235
236 if (signedResult && !result && tableName.substr(tableName.length() - 4) == "_dbc")
237 {
238 LOG_DEBUG("sql.sql", "> Found incorrect value '{}' for type '{}' in _dbc table.", data.value, typeid(T).name());
239 LOG_DEBUG("sql.sql", "> Table name '{}'. Field name '{}'. Try return int32 value", meta->TableName, meta->Name);
240 return GetData<int32>();
241 }
242 }
243 }
244
245 if (auto alias = GetCleanAliasName(meta->Alias))
246 {
247 if ((StringEqualI(*alias, "min") || StringEqualI(*alias, "max")) && !IsCorrectAlias<T>(meta->Type, *alias))
248 {
249 LogWrongType(__FUNCTION__, typeid(T).name());
250 }
251
252 if ((StringEqualI(*alias, "sum") || StringEqualI(*alias, "avg")) && !IsCorrectAlias<T>(meta->Type, *alias))
253 {
254 LogWrongType(__FUNCTION__, typeid(T).name());
255 LOG_WARN("sql.sql", "> Please use GetData<double>()");
256 return GetData<double>();
257 }
258
259 if (StringEqualI(*alias, "count") && !IsCorrectAlias<T>(meta->Type, *alias))
260 {
261 LogWrongType(__FUNCTION__, typeid(T).name());
262 LOG_WARN("sql.sql", "> Please use GetData<uint64>()");
263 return GetData<uint64>();
264 }
265 }
266
267 if (!result)
268 {
269 LOG_FATAL("sql.sql", "> Incorrect value '{}' for type '{}'. Value is raw ? '{}'", data.value, typeid(T).name(), data.raw);
270 LOG_FATAL("sql.sql", "> Table name '{}'. Field name '{}'", meta->TableName, meta->Name);
271 //ABORT();
272 return GetDefaultValue<T>();
273 }
274
275 return *result;
276}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:152
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
#define LOG_WARN(filterType__,...)
Definition: Log.h:160
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
bool StringEqualI(std::string_view a, std::string_view b)
Definition: Util.cpp:592
Optional< std::string_view > GetCleanAliasName(std::string_view alias)
Definition: Field.cpp:105
DatabaseFieldTypes Type
Definition: Field.h:65
std::string Alias
Definition: Field.h:62
std::string TableName
Definition: Field.h:59
std::string Name
Definition: Field.h:61
bool IsType(DatabaseFieldTypes type) const
Definition: Field.cpp:169
void LogWrongType(std::string_view getter, std::string_view typeName) const
Definition: Field.cpp:184

References QueryResultFieldMetadata::Alias, data, IsType(), LOG_DEBUG, LOG_FATAL, LOG_WARN, LogWrongType(), meta, QueryResultFieldMetadata::Name, StringEqualI(), QueryResultFieldMetadata::TableName, and QueryResultFieldMetadata::Type.

◆ GetDataBinary()

Binary Field::GetDataBinary ( ) const
private
323{
324 Binary result = {};
325 if (!data.value || !data.length)
326 return result;
327
328#ifdef ACORE_STRICT_DATABASE_TYPE_CHECKS
329 if (!IsCorrectFieldType<Binary>(meta->Type))
330 {
331 LogWrongType(__FUNCTION__, "Binary");
332 return {};
333 }
334#endif
335
336 result.resize(data.length);
337 memcpy(result.data(), data.value, data.length);
338 return result;
339}
std::vector< uint8 > Binary
Definition: Field.h:41

References data, LogWrongType(), meta, and QueryResultFieldMetadata::Type.

◆ GetDataString()

std::string Field::GetDataString ( ) const
private
291{
292 if (!data.value)
293 return "";
294
295#ifdef ACORE_STRICT_DATABASE_TYPE_CHECKS
296 if (IsNumeric() && data.raw)
297 {
298 LogWrongType(__FUNCTION__, "std::string");
299 return "";
300 }
301#endif
302
303 return { data.value, data.length };
304}
bool IsNumeric() const
Definition: Field.cpp:174

References data, IsNumeric(), and LogWrongType().

◆ GetDataStringView()

std::string_view Field::GetDataStringView ( ) const
private
307{
308 if (!data.value)
309 return {};
310
311#ifdef ACORE_STRICT_DATABASE_TYPE_CHECKS
312 if (IsNumeric() && data.raw)
313 {
314 LogWrongType(__FUNCTION__, "std::string_view");
315 return {};
316 }
317#endif
318
319 return { data.value, data.length };
320}

References data, IsNumeric(), and LogWrongType().

◆ GetType()

DatabaseFieldTypes Field::GetType ( )
inline
150{ return meta->Type; }

◆ IsNull()

bool Field::IsNull ( ) const
inline
108 {
109 return data.value == nullptr;
110 }

Referenced by account_commandscript::HandleAccount2FARemoveCommand(), and ObjectMgr::LoadAccessRequirements().

◆ IsNumeric()

bool Field::IsNumeric ( ) const
protected
175{
176 return (meta->Type == DatabaseFieldTypes::Int8 ||
177 meta->Type == DatabaseFieldTypes::Int16 ||
178 meta->Type == DatabaseFieldTypes::Int32 ||
179 meta->Type == DatabaseFieldTypes::Int64 ||
180 meta->Type == DatabaseFieldTypes::Float ||
181 meta->Type == DatabaseFieldTypes::Double);
182}

References meta, and QueryResultFieldMetadata::Type.

Referenced by GetDataString(), and GetDataStringView().

◆ IsType()

bool Field::IsType ( DatabaseFieldTypes  type) const
protected
170{
171 return meta->Type == type;
172}

References meta, and QueryResultFieldMetadata::Type.

Referenced by GetData().

◆ LogWrongType()

void Field::LogWrongType ( std::string_view  getter,
std::string_view  typeName 
) const
private
185{
186 LOG_WARN("sql.sql", "Warning: {}<{}> on {} field {}.{} ({}.{}) at index {}.",
187 getter, typeName, meta->TypeName, meta->TableAlias, meta->Alias, meta->TableName, meta->Name, meta->Index);
188}
std::string TableAlias
Definition: Field.h:60
std::string TypeName
Definition: Field.h:63
uint32 Index
Definition: Field.h:64

References QueryResultFieldMetadata::Alias, QueryResultFieldMetadata::Index, LOG_WARN, meta, QueryResultFieldMetadata::Name, QueryResultFieldMetadata::TableAlias, QueryResultFieldMetadata::TableName, and QueryResultFieldMetadata::TypeName.

Referenced by GetData(), GetDataBinary(), GetDataString(), and GetDataStringView().

◆ SetByteValue()

void Field::SetByteValue ( char const *  newValue,
uint32  length 
)
protected
154{
155 // This value stores raw bytes that have to be explicitly cast later
156 data.value = newValue;
157 data.length = length;
158 data.raw = true;
159}

References data, and length.

◆ SetMetadata()

void Field::SetMetadata ( QueryResultFieldMetadata const *  fieldMeta)
private
191{
192 meta = fieldMeta;
193}

References meta.

Referenced by ResultSet::ResultSet().

◆ SetStructuredValue()

void Field::SetStructuredValue ( char const *  newValue,
uint32  length 
)
protected
162{
163 // This value stores somewhat structured data that needs function style casting
164 data.value = newValue;
165 data.length = length;
166 data.raw = false;
167}

References data, and length.

Friends And Related Function Documentation

◆ PreparedResultSet

friend class PreparedResultSet
friend

◆ ResultSet

friend class ResultSet
friend

Member Data Documentation

◆ 

◆ length

◆ meta

◆ raw

bool Field::raw

◆ value

char const* Field::value