Merge pull request #17301 from ClickHouse/odbc-minor-changes

Minor changes for ODBC storage
This commit is contained in:
alexey-milovidov 2020-11-29 21:23:20 +03:00 committed by GitHub
commit 0c831e1204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,11 +79,18 @@ namespace
assert_cast<ColumnString &>(column).insert(value.convert<String>());
break;
case ValueType::vtDate:
assert_cast<ColumnUInt16 &>(column).insertValue(UInt16{LocalDate{value.convert<String>()}.getDayNum()});
{
Poco::DateTime date = value.convert<Poco::DateTime>();
assert_cast<ColumnUInt16 &>(column).insertValue(UInt16{LocalDate(date.year(), date.month(), date.day()).getDayNum()});
break;
}
case ValueType::vtDateTime:
assert_cast<ColumnUInt32 &>(column).insertValue(time_t{LocalDateTime{value.convert<String>()}});
{
Poco::DateTime datetime = value.convert<Poco::DateTime>();
assert_cast<ColumnUInt32 &>(column).insertValue(time_t{LocalDateTime(
datetime.year(), datetime.month(), datetime.day(), datetime.hour(), datetime.minute(), datetime.second())});
break;
}
case ValueType::vtUUID:
assert_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>()));
break;
@ -112,6 +119,7 @@ Block ODBCBlockInputStream::readImpl()
for (const auto idx : ext::range(0, row.fieldCount()))
{
/// TODO This is extremely slow.
const Poco::Dynamic::Var & value = row[idx];
if (!value.isEmpty())