#pragma once #include #include #include #include namespace DB { /** Типы данных для представления значений из БД в оперативке. */ STRONG_TYPEDEF(char, Null); using UInt8 = Poco::UInt8; using UInt16 = Poco::UInt16; using UInt32 = Poco::UInt32; using UInt64 = Poco::UInt64; using Int8 = Poco::Int8; using Int16 = Poco::Int16; using Int32 = Poco::Int32; using Int64 = Poco::Int64; using Float32 = float; using Float64 = double; using String = std::string; using Strings = std::vector; /// Ordinary types with nullability. template struct Nullable { using Type = T; }; template struct RemoveNullable { using Type = T; }; template struct RemoveNullable > { using Type = T; }; template struct IsNullable { static constexpr bool value = !std::is_same::Type>::value; }; template struct IsNumber { static constexpr bool value = false; }; template struct IsNumber > { static constexpr bool value = IsNumber::value; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template <> struct IsNumber { static constexpr bool value = true; }; template struct TypeName; template struct TypeName > { static std::string get() { return "Nullable(" + TypeName::get() + ")"; } }; template <> struct TypeName { static std::string get() { return "Null"; } }; template <> struct TypeName > : TypeName {}; template <> struct TypeName { static std::string get() { return "UInt8"; } }; template <> struct TypeName { static std::string get() { return "UInt16"; } }; template <> struct TypeName { static std::string get() { return "UInt32"; } }; template <> struct TypeName { static std::string get() { return "UInt64"; } }; template <> struct TypeName { static std::string get() { return "Int8"; } }; template <> struct TypeName { static std::string get() { return "Int16"; } }; template <> struct TypeName { static std::string get() { return "Int32"; } }; template <> struct TypeName { static std::string get() { return "Int64"; } }; template <> struct TypeName { static std::string get() { return "Float32"; } }; template <> struct TypeName { static std::string get() { return "Float64"; } }; template <> struct TypeName { static std::string get() { return "String"; } }; /// Этот тип не поддерживается СУБД, но используется в некоторых внутренних преобразованиях. template <> struct TypeName{ static std::string get() { return "long double"; } }; }