| 115 | using ValueType = ExternalResultDescription::ValueType; |
| 116 | |
| 117 | void insertValue(const IDataType & data_type, IColumn & column, const ValueType type, const mysqlxx::Value & value, size_t & read_bytes_size) |
| 118 | { |
| 119 | switch (type) |
| 120 | { |
| 121 | case ValueType::vtUInt8: |
| 122 | assert_cast<ColumnUInt8 &>(column).insertValue(value.getUInt()); |
| 123 | read_bytes_size += 1; |
| 124 | break; |
| 125 | case ValueType::vtUInt16: |
| 126 | assert_cast<ColumnUInt16 &>(column).insertValue(value.getUInt()); |
| 127 | read_bytes_size += 2; |
| 128 | break; |
| 129 | case ValueType::vtUInt32: |
| 130 | assert_cast<ColumnUInt32 &>(column).insertValue(value.getUInt()); |
| 131 | read_bytes_size += 4; |
| 132 | break; |
| 133 | case ValueType::vtUInt64: |
| 134 | assert_cast<ColumnUInt64 &>(column).insertValue(value.getUInt()); |
| 135 | read_bytes_size += 8; |
| 136 | break; |
| 137 | case ValueType::vtInt8: |
| 138 | assert_cast<ColumnInt8 &>(column).insertValue(value.getInt()); |
| 139 | read_bytes_size += 1; |
| 140 | break; |
| 141 | case ValueType::vtInt16: |
| 142 | assert_cast<ColumnInt16 &>(column).insertValue(value.getInt()); |
| 143 | read_bytes_size += 2; |
| 144 | break; |
| 145 | case ValueType::vtInt32: |
| 146 | assert_cast<ColumnInt32 &>(column).insertValue(value.getInt()); |
| 147 | read_bytes_size += 4; |
| 148 | break; |
| 149 | case ValueType::vtInt64: |
| 150 | assert_cast<ColumnInt64 &>(column).insertValue(value.getInt()); |
| 151 | read_bytes_size += 8; |
| 152 | break; |
| 153 | case ValueType::vtFloat32: |
| 154 | assert_cast<ColumnFloat32 &>(column).insertValue(value.getDouble()); |
| 155 | read_bytes_size += 4; |
| 156 | break; |
| 157 | case ValueType::vtFloat64: |
| 158 | assert_cast<ColumnFloat64 &>(column).insertValue(value.getDouble()); |
| 159 | read_bytes_size += 8; |
| 160 | break; |
| 161 | case ValueType::vtEnum8: |
| 162 | assert_cast<ColumnInt8 &>(column).insertValue(assert_cast<const DataTypeEnum<Int8> &>(data_type).castToValue(value.data()).get<Int8>()); |
| 163 | read_bytes_size += assert_cast<ColumnInt8 &>(column).byteSize(); |
| 164 | break; |
| 165 | case ValueType::vtEnum16: |
| 166 | assert_cast<ColumnInt16 &>(column).insertValue(assert_cast<const DataTypeEnum<Int16> &>(data_type).castToValue(value.data()).get<Int16>()); |
| 167 | read_bytes_size += assert_cast<ColumnInt16 &>(column).byteSize(); |
| 168 | break; |
| 169 | case ValueType::vtString: |
| 170 | assert_cast<ColumnString &>(column).insertData(value.data(), value.size()); |
| 171 | read_bytes_size += assert_cast<ColumnString &>(column).byteSize(); |
| 172 | break; |
| 173 | case ValueType::vtDate: |
| 174 | assert_cast<ColumnUInt16 &>(column).insertValue(UInt16(value.getDate().getDayNum())); |
no test coverage detected