diff --git a/include/sqlpp11/date.h b/include/sqlpp11/date.h index 2ebf784d..a2b80a64 100644 --- a/include/sqlpp11/date.h +++ b/include/sqlpp11/date.h @@ -42,7 +42,7 @@ namespace sqlpp { using _traits = make_traits; using _tag = tag::is_date; - using _cpp_value_type = day_point; + using _cpp_value_type = cpp::day_point; template using _is_valid_operand = is_time_point_t; @@ -74,7 +74,7 @@ namespace sqlpp { if (t._is_trivial()) { - _value = day_point{}; + _value = _cpp_value_type{}; _is_null = true; } else @@ -87,7 +87,7 @@ namespace sqlpp void set_null() { - _value = day_point{}; + _value = _cpp_value_type{}; _is_null = true; } @@ -148,7 +148,7 @@ namespace sqlpp { _is_valid = false; _is_null = true; - _value = day_point{}; + _value = _cpp_value_type{}; } void _validate() @@ -168,7 +168,7 @@ namespace sqlpp if (not _is_valid) throw exception("accessing is_null in non-existing row"); - return value() == day_point{}; + return value() == _cpp_value_type{}; } _cpp_value_type value() const @@ -184,7 +184,7 @@ namespace sqlpp } else { - return day_point{}; + return _cpp_value_type{}; } } return _value; @@ -193,7 +193,7 @@ namespace sqlpp template void _bind(Target& target, size_t i) { - target._bind_date_result(i, &_value, &_is_null); + target._bind_day_point_result(i, &_value, &_is_null); } private: @@ -201,12 +201,5 @@ namespace sqlpp bool _is_null; _cpp_value_type _value; }; - - // ostream operator for date result field - template - inline std::ostream& operator<<(std::ostream& os, const result_field_t& e) - { - return serialize(e, os); - } } #endif diff --git a/include/sqlpp11/date_time.h b/include/sqlpp11/date_time.h index f8a11831..659cd20c 100644 --- a/include/sqlpp11/date_time.h +++ b/include/sqlpp11/date_time.h @@ -42,7 +42,7 @@ namespace sqlpp { using _traits = make_traits; using _tag = tag::is_date_time; - using _cpp_value_type = ms_point; + using _cpp_value_type = cpp::ms_point; template using _is_valid_operand = is_time_point_t; @@ -74,7 +74,7 @@ namespace sqlpp { if (t._is_trivial()) { - _value = day_point{}; + _value = _cpp_value_type{}; _is_null = true; } else @@ -87,7 +87,7 @@ namespace sqlpp void set_null() { - _value = day_point{}; + _value = _cpp_value_type{}; _is_null = true; } @@ -149,7 +149,7 @@ namespace sqlpp { _is_valid = false; _is_null = true; - _value = day_point{}; + _value = _cpp_value_type{}; } void _validate() @@ -169,7 +169,7 @@ namespace sqlpp if (not _is_valid) throw exception("accessing is_null in non-existing row"); - return value() == day_point{}; + return value() == _cpp_value_type{}; } _cpp_value_type value() const @@ -185,7 +185,7 @@ namespace sqlpp } else { - return day_point{}; + return _cpp_value_type{}; } } return _value; @@ -202,12 +202,5 @@ namespace sqlpp bool _is_null; _cpp_value_type _value; }; - - // ostream operator for date_time result field - template - inline std::ostream& operator<<(std::ostream& os, const result_field_t& e) - { - return serialize(e, os); - } } #endif diff --git a/include/sqlpp11/date_time_fwd.h b/include/sqlpp11/date_time_fwd.h index 80c960db..8ed68c38 100644 --- a/include/sqlpp11/date_time_fwd.h +++ b/include/sqlpp11/date_time_fwd.h @@ -31,10 +31,13 @@ namespace sqlpp { - using days = std::chrono::duration, std::chrono::hours::period>>; + namespace cpp + { + using days = std::chrono::duration, std::chrono::hours::period>>; - using day_point = std::chrono::time_point; - using ms_point = std::chrono::time_point; + using day_point = std::chrono::time_point; + using ms_point = std::chrono::time_point; + } struct date; struct date_time; diff --git a/include/sqlpp11/wrap_operand.h b/include/sqlpp11/wrap_operand.h index b829e255..aaedd510 100644 --- a/include/sqlpp11/wrap_operand.h +++ b/include/sqlpp11/wrap_operand.h @@ -71,14 +71,14 @@ namespace sqlpp _value_t _t; }; - template - struct date_time_operand : public alias_operators> + template + struct date_time_operand : public alias_operators> { using _traits = make_traits; using _nodes = detail::type_vector<>; using _is_aggregate_expression = std::true_type; - using _value_t = std::chrono::time_point; + using _value_t = std::chrono::time_point; date_time_operand() : _t{} { @@ -96,7 +96,7 @@ namespace sqlpp bool _is_trivial() const { - return _t == day_point{}; + return _t == _value_t{}; } _value_t _t; @@ -256,10 +256,10 @@ namespace sqlpp using type = boolean_operand; }; - template - struct wrap_operand, void> + template + struct wrap_operand, void> { - using type = date_time_operand; + using type = date_time_operand; }; template