TrinityCore
FieldValueConverter.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "FieldValueConverter.h"
19#include "Errors.h"
20#include "Field.h"
21
24
26{
27 char const* expectedAccessor = "";
28 switch (meta->Type)
29 {
30 case DatabaseFieldTypes::UInt8: expectedAccessor = "Field::GetUInt8"; break;
31 case DatabaseFieldTypes::Int8: expectedAccessor = "Field::GetInt8"; break;
32 case DatabaseFieldTypes::UInt16: expectedAccessor = "Field::GetUInt16"; break;
33 case DatabaseFieldTypes::Int16: expectedAccessor = "Field::GetInt16"; break;
34 case DatabaseFieldTypes::UInt32: expectedAccessor = "Field::GetUIn32"; break;
35 case DatabaseFieldTypes::Int32: expectedAccessor = "Field::GetInt32"; break;
36 case DatabaseFieldTypes::UInt64: expectedAccessor = "Field::GetUIn64"; break;
37 case DatabaseFieldTypes::Int64: expectedAccessor = "Field::GetInt64"; break;
38 case DatabaseFieldTypes::Float: expectedAccessor = "Field::GetFloat"; break;
39 case DatabaseFieldTypes::Double: expectedAccessor = "Field::GetDouble"; break;
40 case DatabaseFieldTypes::Decimal: expectedAccessor = "Field::GetDouble or Field::GetString"; break;
41 case DatabaseFieldTypes::Binary: expectedAccessor = "Field::GetString or Field::GetBinary"; break;
42 default:
43 break;
44 }
45
46 ASSERT(false, "%s on %s field %s.%s (%s.%s) at index %u caused value to be truncated. Use %s instead.",
47 getter, meta->TypeName, meta->TableAlias, meta->Alias, meta->TableName, meta->Name, meta->Index, expectedAccessor);
48}
#define ASSERT
Definition: Errors.h:68
static void LogTruncation(char const *getter, QueryResultFieldMetadata const *meta)
DatabaseFieldTypes Type
Definition: Field.h:55
char const * Alias
Definition: Field.h:52
char const * TableAlias
Definition: Field.h:50
char const * TableName
Definition: Field.h:49
char const * TypeName
Definition: Field.h:53
char const * Name
Definition: Field.h:51