| 163 | |
| 164 | template <typename Type> |
| 165 | Field DataTypeEnum<Type>::castToName(const Field & value_or_name) const |
| 166 | { |
| 167 | if (value_or_name.getType() == Field::Types::String) |
| 168 | { |
| 169 | this->getValue(value_or_name.safeGet<String>()); /// Check correctness |
| 170 | return value_or_name.safeGet<String>(); |
| 171 | } |
| 172 | if (value_or_name.getType() == Field::Types::Int64) |
| 173 | { |
| 174 | Int64 value = value_or_name.safeGet<Int64>(); |
| 175 | checkOverflow<Type>(value); |
| 176 | return std::string{this->getNameForValue(static_cast<Type>(value))}; |
| 177 | } |
| 178 | throw Exception(ErrorCodes::BAD_TYPE_OF_FIELD, "DataTypeEnum: Unsupported type of field {}", value_or_name.getTypeName()); |
| 179 | } |
| 180 | |
| 181 | template <typename Type> |
| 182 | Field DataTypeEnum<Type>::castToValue(const Field & value_or_name) const |
no test coverage detected