mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
sqxxl: added Loader, added support in DBObjects [#CONV-2944].
This commit is contained in:
parent
048898245b
commit
cb5d044eb5
@ -9,7 +9,8 @@
|
||||
|
||||
#include <Poco/NumberFormatter.h>
|
||||
|
||||
#include <mysqlxx/mysqlxx.h>
|
||||
#include <Yandex/Common.h> /// Yandex::VisitID_t
|
||||
#include <mysqlxx/mysqlxx.h> /// mysqlxx::Date, mysqlxx::DateTime
|
||||
|
||||
#include <DB/Core/Types.h>
|
||||
#include <DB/Core/Exception.h>
|
||||
@ -189,5 +190,36 @@ template <> struct NearestFieldType<Int64> { typedef Int64 Type; };
|
||||
template <> struct NearestFieldType<Float32> { typedef Float64 Type; };
|
||||
template <> struct NearestFieldType<Float64> { typedef Float64 Type; };
|
||||
template <> struct NearestFieldType<String> { typedef String Type; };
|
||||
template <> struct NearestFieldType<bool> { typedef UInt64 Type; };
|
||||
|
||||
|
||||
/// Перевести что угодно в Field.
|
||||
template <typename T>
|
||||
inline Field toField(const T & x)
|
||||
{
|
||||
return Field(typename NearestFieldType<T>::Type(x));
|
||||
}
|
||||
|
||||
inline Field toField(const mysqlxx::Date & x)
|
||||
{
|
||||
return toField(static_cast<UInt16>(x.getDayNum()));
|
||||
}
|
||||
|
||||
inline Field toField(const mysqlxx::DateTime & x)
|
||||
{
|
||||
return toField(static_cast<UInt32>(static_cast<time_t>(x)));
|
||||
}
|
||||
|
||||
inline Field toField(const Yandex::VisitID_t & x)
|
||||
{
|
||||
return toField(static_cast<UInt64>(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline Field toField(const mysqlxx::Null<T> & x)
|
||||
{
|
||||
return x.isNull() ? Field(Null()) : toField(static_cast<const T &>(x));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user