Minor changed for ODBC storage

This commit is contained in:
Alexey Milovidov 2020-11-23 13:32:56 +03:00
parent e82e645305
commit 77c963dec5

View File

@ -79,10 +79,13 @@ namespace
assert_cast<ColumnString &>(column).insert(value.convert<String>()); assert_cast<ColumnString &>(column).insert(value.convert<String>());
break; break;
case ValueType::vtDate: 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; break;
case ValueType::vtDateTime: 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; break;
case ValueType::vtUUID: case ValueType::vtUUID:
assert_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>())); assert_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>()));
@ -112,6 +115,7 @@ Block ODBCBlockInputStream::readImpl()
for (const auto idx : ext::range(0, row.fieldCount())) for (const auto idx : ext::range(0, row.fieldCount()))
{ {
/// TODO This is extremely slow.
const Poco::Dynamic::Var & value = row[idx]; const Poco::Dynamic::Var & value = row[idx];
if (!value.isEmpty()) if (!value.isEmpty())