AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
anonymous_namespace{QueryResult.cpp} Namespace Reference

Functions

static uint32 SizeForType (MYSQL_FIELD *field)
 
DatabaseFieldTypes MysqlTypeToFieldType (enum_field_types type)
 
static std::string FieldTypeToString (enum_field_types type)
 
void InitializeDatabaseFieldMetadata (QueryResultFieldMetadata *meta, MySQLField const *field, uint32 fieldIndex)
 

Function Documentation

◆ FieldTypeToString()

static std::string anonymous_namespace{QueryResult.cpp}::FieldTypeToString ( enum_field_types  type)
static
122 {
123 switch (type)
124 {
125 case MYSQL_TYPE_BIT: return "BIT";
126 case MYSQL_TYPE_BLOB: return "BLOB";
127 case MYSQL_TYPE_DATE: return "DATE";
128 case MYSQL_TYPE_DATETIME: return "DATETIME";
129 case MYSQL_TYPE_NEWDECIMAL: return "NEWDECIMAL";
130 case MYSQL_TYPE_DECIMAL: return "DECIMAL";
131 case MYSQL_TYPE_DOUBLE: return "DOUBLE";
132 case MYSQL_TYPE_ENUM: return "ENUM";
133 case MYSQL_TYPE_FLOAT: return "FLOAT";
134 case MYSQL_TYPE_GEOMETRY: return "GEOMETRY";
135 case MYSQL_TYPE_INT24: return "INT24";
136 case MYSQL_TYPE_LONG: return "LONG";
137 case MYSQL_TYPE_LONGLONG: return "LONGLONG";
138 case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB";
139 case MYSQL_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
140 case MYSQL_TYPE_NEWDATE: return "NEWDATE";
141 case MYSQL_TYPE_NULL: return "NULL";
142 case MYSQL_TYPE_SET: return "SET";
143 case MYSQL_TYPE_SHORT: return "SHORT";
144 case MYSQL_TYPE_STRING: return "STRING";
145 case MYSQL_TYPE_TIME: return "TIME";
146 case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP";
147 case MYSQL_TYPE_TINY: return "TINY";
148 case MYSQL_TYPE_TINY_BLOB: return "TINY_BLOB";
149 case MYSQL_TYPE_VAR_STRING: return "VAR_STRING";
150 case MYSQL_TYPE_YEAR: return "YEAR";
151 default: return "-Unknown-";
152 }
153 }

Referenced by InitializeDatabaseFieldMetadata().

◆ InitializeDatabaseFieldMetadata()

void anonymous_namespace{QueryResult.cpp}::InitializeDatabaseFieldMetadata ( QueryResultFieldMetadata meta,
MySQLField const *  field,
uint32  fieldIndex 
)
156 {
157 meta->TableName = field->org_table;
158 meta->TableAlias = field->table;
159 meta->Name = field->org_name;
160 meta->Alias = field->name;
161 meta->TypeName = FieldTypeToString(field->type);
162 meta->Index = fieldIndex;
163 meta->Type = MysqlTypeToFieldType(field->type);
164 }
DatabaseFieldTypes MysqlTypeToFieldType(enum_field_types type)
Definition: QueryResult.cpp:77
static std::string FieldTypeToString(enum_field_types type)
Definition: QueryResult.cpp:121
DatabaseFieldTypes Type
Definition: Field.h:64
std::string TableAlias
Definition: Field.h:59
std::string TypeName
Definition: Field.h:62
std::string Alias
Definition: Field.h:61
uint32 Index
Definition: Field.h:63
std::string TableName
Definition: Field.h:58
std::string Name
Definition: Field.h:60

References QueryResultFieldMetadata::Alias, FieldTypeToString(), QueryResultFieldMetadata::Index, MysqlTypeToFieldType(), QueryResultFieldMetadata::Name, QueryResultFieldMetadata::TableAlias, QueryResultFieldMetadata::TableName, QueryResultFieldMetadata::Type, and QueryResultFieldMetadata::TypeName.

◆ MysqlTypeToFieldType()

DatabaseFieldTypes anonymous_namespace{QueryResult.cpp}::MysqlTypeToFieldType ( enum_field_types  type)
78 {
79 switch (type)
80 {
81 case MYSQL_TYPE_NULL:
83 case MYSQL_TYPE_TINY:
85 case MYSQL_TYPE_YEAR:
86 case MYSQL_TYPE_SHORT:
88 case MYSQL_TYPE_INT24:
89 case MYSQL_TYPE_LONG:
91 case MYSQL_TYPE_LONGLONG:
92 case MYSQL_TYPE_BIT:
94 case MYSQL_TYPE_FLOAT:
96 case MYSQL_TYPE_DOUBLE:
98 case MYSQL_TYPE_DECIMAL:
99 case MYSQL_TYPE_NEWDECIMAL:
101 case MYSQL_TYPE_TIMESTAMP:
102 case MYSQL_TYPE_DATE:
103 case MYSQL_TYPE_TIME:
104 case MYSQL_TYPE_DATETIME:
106 case MYSQL_TYPE_TINY_BLOB:
107 case MYSQL_TYPE_MEDIUM_BLOB:
108 case MYSQL_TYPE_LONG_BLOB:
109 case MYSQL_TYPE_BLOB:
110 case MYSQL_TYPE_STRING:
111 case MYSQL_TYPE_VAR_STRING:
113 default:
114 LOG_WARN("sql.sql", "MysqlTypeToFieldType(): invalid field type {}", uint32(type));
115 break;
116 }
117
119 }
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
std::uint32_t uint32
Definition: Define.h:107

References Binary, Date, Decimal, Double, Float, Int16, Int32, Int64, Int8, LOG_WARN, and Null.

Referenced by InitializeDatabaseFieldMetadata().

◆ SizeForType()

static uint32 anonymous_namespace{QueryResult.cpp}::SizeForType ( MYSQL_FIELD *  field)
static
28 {
29 switch (field->type)
30 {
31 case MYSQL_TYPE_NULL:
32 return 0;
33 case MYSQL_TYPE_TINY:
34 return 1;
35 case MYSQL_TYPE_YEAR:
36 case MYSQL_TYPE_SHORT:
37 return 2;
38 case MYSQL_TYPE_INT24:
39 case MYSQL_TYPE_LONG:
40 case MYSQL_TYPE_FLOAT:
41 return 4;
42 case MYSQL_TYPE_DOUBLE:
43 case MYSQL_TYPE_LONGLONG:
44 case MYSQL_TYPE_BIT:
45 return 8;
46
47 case MYSQL_TYPE_TIMESTAMP:
48 case MYSQL_TYPE_DATE:
49 case MYSQL_TYPE_TIME:
50 case MYSQL_TYPE_DATETIME:
51 return sizeof(MYSQL_TIME);
52
53 case MYSQL_TYPE_TINY_BLOB:
54 case MYSQL_TYPE_MEDIUM_BLOB:
55 case MYSQL_TYPE_LONG_BLOB:
56 case MYSQL_TYPE_BLOB:
57 case MYSQL_TYPE_STRING:
58 case MYSQL_TYPE_VAR_STRING:
59 return field->max_length + 1;
60
61 case MYSQL_TYPE_DECIMAL:
62 case MYSQL_TYPE_NEWDECIMAL:
63 return 64;
64
65 case MYSQL_TYPE_GEOMETRY:
66 /*
67 Following types are not sent over the wire:
68 MYSQL_TYPE_ENUM:
69 MYSQL_TYPE_SET:
70 */
71 default:
72 LOG_WARN("sql.sql", "SQL::SizeForType(): invalid field type {}", uint32(field->type));
73 return 0;
74 }
75 }

References LOG_WARN.