Fix type in odbc source and remove pointer from mongo source

This commit is contained in:
alesapin 2018-09-05 23:33:45 +03:00
parent cd07fd6246
commit aaf5720198
2 changed files with 3 additions and 4 deletions

View File

@ -79,9 +79,8 @@ namespace
}
void insertValue(
IColumn & column, const ValueType type, Poco::MongoDB::Element::Ptr value_ptr, const std::string & name)
IColumn & column, const ValueType type, const Poco::MongoDB::Element & value, const std::string & name)
{
const Poco::MongoDB::Element & value = *value_ptr;
switch (type)
{
case ValueType::UInt8: insertNumber<UInt8>(column, value, name); break;
@ -186,7 +185,7 @@ Block MongoDBBlockInputStream::readImpl()
if (value.isNull() || value->type() == Poco::MongoDB::ElementTraits<Poco::MongoDB::NullValue>::TypeId)
insertDefaultValue(*columns[idx], *description.sample_columns[idx]);
else
insertValue(*columns[idx], description.types[idx], value, name);
insertValue(*columns[idx], description.types[idx], *value, name);
}
}

View File

@ -60,7 +60,7 @@ namespace
case ValueType::String: static_cast<ColumnString &>(column).insert(value.convert<String>()); break;
case ValueType::Date: static_cast<ColumnUInt16 &>(column).insert(UInt16{LocalDate{value.convert<String>()}.getDayNum()}); break;
case ValueType::DateTime: static_cast<ColumnUInt32 &>(column).insert(time_t{LocalDateTime{value.convert<String>()}}); break;
case ValueType::UUID: static_cast<ColumnUInt128 &>(column).insert(parse<UInt128>(value.convert<std::string>())); break;
case ValueType::UUID: static_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>())); break;
}
}