| 180 | |
| 181 | template <typename Type> |
| 182 | Field DataTypeEnum<Type>::castToValue(const Field & value_or_name) const |
| 183 | { |
| 184 | if (value_or_name.getType() == Field::Types::String) |
| 185 | { |
| 186 | return this->getValue(value_or_name.safeGet<String>()); |
| 187 | } |
| 188 | if (value_or_name.getType() == Field::Types::Int64 || value_or_name.getType() == Field::Types::UInt64) |
| 189 | { |
| 190 | Int64 value = value_or_name.safeGet<Int64>(); |
| 191 | checkOverflow<Type>(value); |
| 192 | this->getNameForValue(static_cast<Type>(value)); /// Check correctness |
| 193 | return value; |
| 194 | } |
| 195 | throw Exception(ErrorCodes::BAD_TYPE_OF_FIELD, "DataTypeEnum: Unsupported type of field {}", value_or_name.getTypeName()); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | template <typename Type> |
no test coverage detected