| 215 | using ValueType = ExternalResultDescription::ValueType; |
| 216 | |
| 217 | void insertValue(const IDataType & data_type, IColumn & column, const ValueType type, const mysqlxx::Value & value, size_t & read_bytes_size, enum enum_field_types mysql_type) |
| 218 | { |
| 219 | switch (type) |
| 220 | { |
| 221 | case ValueType::vtUInt8: |
| 222 | assert_cast<ColumnUInt8 &>(column).insertValue(static_cast<UInt8>(value.getUInt())); |
| 223 | read_bytes_size += 1; |
| 224 | break; |
| 225 | case ValueType::vtUInt16: |
| 226 | assert_cast<ColumnUInt16 &>(column).insertValue(static_cast<UInt16>(value.getUInt())); |
| 227 | read_bytes_size += 2; |
| 228 | break; |
| 229 | case ValueType::vtUInt32: |
| 230 | assert_cast<ColumnUInt32 &>(column).insertValue(static_cast<UInt32>(value.getUInt())); |
| 231 | read_bytes_size += 4; |
| 232 | break; |
| 233 | case ValueType::vtUInt64: |
| 234 | { |
| 235 | if (mysql_type == enum_field_types::MYSQL_TYPE_BIT) |
| 236 | { |
| 237 | size_t n = value.size(); |
| 238 | UInt64 val = 0UL; |
| 239 | char * to = reinterpret_cast<char *>(&val); |
| 240 | memcpy(to, const_cast<char *>(value.data()), n); |
| 241 | |
| 242 | if constexpr (std::endian::native == std::endian::little) |
| 243 | { |
| 244 | char * start = to; |
| 245 | char * end = to + n; |
| 246 | std::reverse(start, end); |
| 247 | } |
| 248 | assert_cast<ColumnUInt64 &>(column).insertValue(val); |
| 249 | read_bytes_size += n; |
| 250 | } |
| 251 | else |
| 252 | { |
| 253 | assert_cast<ColumnUInt64 &>(column).insertValue(value.getUInt()); |
| 254 | read_bytes_size += 8; |
| 255 | } |
| 256 | break; |
| 257 | } |
| 258 | case ValueType::vtInt8: |
| 259 | assert_cast<ColumnInt8 &>(column).insertValue(static_cast<Int8>(value.getInt())); |
| 260 | read_bytes_size += 1; |
| 261 | break; |
| 262 | case ValueType::vtInt16: |
| 263 | assert_cast<ColumnInt16 &>(column).insertValue(static_cast<Int16>(value.getInt())); |
| 264 | read_bytes_size += 2; |
| 265 | break; |
| 266 | case ValueType::vtInt32: |
| 267 | assert_cast<ColumnInt32 &>(column).insertValue(static_cast<Int32>(value.getInt())); |
| 268 | read_bytes_size += 4; |
| 269 | break; |
| 270 | case ValueType::vtInt64: |
| 271 | { |
| 272 | if (mysql_type == enum_field_types::MYSQL_TYPE_TIME) |
| 273 | { |
| 274 | String time_str(value.data(), value.size()); |
no test coverage detected