added type check methods to column_definition
This commit is contained in:
parent
e14d9a77eb
commit
05c0c0393d
|
|
@ -53,6 +53,15 @@ public:
|
|||
[[nodiscard]] const std::string& ref_table() const;
|
||||
[[nodiscard]] const std::string& ref_column() const;
|
||||
|
||||
[[nodiscard]] bool is_integer() const;
|
||||
[[nodiscard]] bool is_floating_point() const;
|
||||
[[nodiscard]] bool is_bool() const;
|
||||
[[nodiscard]] bool is_string() const;
|
||||
[[nodiscard]] bool is_varchar() const;
|
||||
[[nodiscard]] bool is_blob() const;
|
||||
[[nodiscard]] bool is_null() const;
|
||||
[[nodiscard]] bool is_unknown() const;
|
||||
|
||||
void type(data_type_t type);
|
||||
|
||||
template< typename Type >
|
||||
|
|
|
|||
|
|
@ -63,6 +63,46 @@ const std::string &column_definition::ref_column() const
|
|||
return ref_column_;
|
||||
}
|
||||
|
||||
bool column_definition::is_integer() const
|
||||
{
|
||||
return type_ >= data_type_t::type_char && type_ <= data_type_t::type_unsigned_long_long;
|
||||
}
|
||||
|
||||
bool column_definition::is_floating_point() const
|
||||
{
|
||||
return type_ == data_type_t::type_float || type_ == data_type_t::type_double;
|
||||
}
|
||||
|
||||
bool column_definition::is_bool() const
|
||||
{
|
||||
return type_ == data_type_t::type_bool;
|
||||
}
|
||||
|
||||
bool column_definition::is_string() const
|
||||
{
|
||||
return type_ == data_type_t::type_text;
|
||||
}
|
||||
|
||||
bool column_definition::is_varchar() const
|
||||
{
|
||||
return type_ == data_type_t::type_varchar;
|
||||
}
|
||||
|
||||
bool column_definition::is_blob() const
|
||||
{
|
||||
return type_ == data_type_t::type_blob;
|
||||
}
|
||||
|
||||
bool column_definition::is_null() const
|
||||
{
|
||||
return type_ == data_type_t::type_null;
|
||||
}
|
||||
|
||||
bool column_definition::is_unknown() const
|
||||
{
|
||||
return type_ == data_type_t::type_unknown;
|
||||
}
|
||||
|
||||
void column_definition::type(data_type_t type)
|
||||
{
|
||||
type_ = type;
|
||||
|
|
|
|||
Loading…
Reference in New Issue