Renamed date/date_time to day_point/time_point

This commit is contained in:
rbock
2015-10-29 16:41:45 +01:00
parent 5e83929555
commit 84ab264702
11 changed files with 146 additions and 145 deletions
+28 -28
View File
@@ -98,49 +98,49 @@ namespace test
};
using _traits = sqlpp::make_traits<sqlpp::boolean, sqlpp::tag::can_be_null>;
};
struct SomeDate
struct SomeDayPoint
{
struct _alias_t
{
static constexpr const char _literal[] = "some_date";
static constexpr const char _literal[] = "some_day_point";
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
template <typename T>
struct _member_t
{
T someDate;
T someDayPoint;
T& operator()()
{
return someDate;
return someDayPoint;
}
const T& operator()() const
{
return someDate;
return someDayPoint;
}
};
};
using _traits = sqlpp::make_traits<sqlpp::date, sqlpp::tag::can_be_null>;
using _traits = sqlpp::make_traits<sqlpp::day_point, sqlpp::tag::can_be_null>;
};
struct SomeDateTime
struct SomeTimePoint
{
struct _alias_t
{
static constexpr const char _literal[] = "some_date_time";
static constexpr const char _literal[] = "some_time_point";
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
template <typename T>
struct _member_t
{
T someDateTime;
T someTimePoint;
T& operator()()
{
return someDateTime;
return someTimePoint;
}
const T& operator()() const
{
return someDateTime;
return someTimePoint;
}
};
};
using _traits = sqlpp::make_traits<sqlpp::date_time, sqlpp::tag::can_be_null>;
using _traits = sqlpp::make_traits<sqlpp::time_point, sqlpp::tag::can_be_null>;
};
struct OtherInt
{
@@ -208,49 +208,49 @@ namespace test
};
using _traits = sqlpp::make_traits<sqlpp::boolean, sqlpp::tag::can_be_null>;
};
struct OtherDate
struct OtherDayPoint
{
struct _alias_t
{
static constexpr const char _literal[] = "other_date";
static constexpr const char _literal[] = "other_day_point";
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
template <typename T>
struct _member_t
{
T otherDate;
T otherDayPoint;
T& operator()()
{
return otherDate;
return otherDayPoint;
}
const T& operator()() const
{
return otherDate;
return otherDayPoint;
}
};
};
using _traits = sqlpp::make_traits<sqlpp::date, sqlpp::tag::can_be_null>;
using _traits = sqlpp::make_traits<sqlpp::day_point, sqlpp::tag::can_be_null>;
};
struct OtherDateTime
struct OtherTimePoint
{
struct _alias_t
{
static constexpr const char _literal[] = "other_date_time";
static constexpr const char _literal[] = "other_time_point";
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
template <typename T>
struct _member_t
{
T otherDateTime;
T otherTimePoint;
T& operator()()
{
return otherDateTime;
return otherTimePoint;
}
const T& operator()() const
{
return otherDateTime;
return otherTimePoint;
}
};
};
using _traits = sqlpp::make_traits<sqlpp::date_time, sqlpp::tag::can_be_null>;
using _traits = sqlpp::make_traits<sqlpp::time_point, sqlpp::tag::can_be_null>;
};
}
@@ -259,13 +259,13 @@ namespace test
TabAllTypes_::SomeInt,
TabAllTypes_::SomeFloat,
TabAllTypes_::SomeBool,
TabAllTypes_::SomeDate,
TabAllTypes_::SomeDateTime,
TabAllTypes_::SomeDayPoint,
TabAllTypes_::SomeTimePoint,
TabAllTypes_::OtherInt,
TabAllTypes_::OtherFloat,
TabAllTypes_::OtherBool,
TabAllTypes_::OtherDate,
TabAllTypes_::OtherDateTime>
TabAllTypes_::OtherDayPoint,
TabAllTypes_::OtherTimePoint>
{
struct _alias_t
{
+7 -7
View File
@@ -46,16 +46,16 @@ namespace
template <typename Assert, typename Operand>
void static_check_comparison(const Operand& operand)
{
using CheckResult = sqlpp::check_rhs_comparison_operand_t<decltype(t.someDate), Operand>;
using CheckResult = sqlpp::check_rhs_comparison_operand_t<decltype(t.someDayPoint), Operand>;
using ExpectedCheckResult = std::is_same<CheckResult, Assert>;
static_assert(ExpectedCheckResult::value, "Unexpected check result");
print_type_on_error<CheckResult>(ExpectedCheckResult{});
using ReturnType = sqlpp::detail::make_type_set_t<
decltype(t.someDate < operand), decltype(t.someDate <= operand), decltype(t.someDate == operand),
decltype(t.someDate != operand), decltype(t.someDate >= operand), decltype(t.someDate > operand),
decltype(t.someDate.in(operand)), decltype(t.someDate.in(operand, operand)),
decltype(t.someDate.not_in(operand)), decltype(t.someDate.not_in(operand, operand))>;
decltype(t.someDayPoint < operand), decltype(t.someDayPoint <= operand), decltype(t.someDayPoint == operand),
decltype(t.someDayPoint != operand), decltype(t.someDayPoint >= operand), decltype(t.someDayPoint > operand),
decltype(t.someDayPoint.in(operand)), decltype(t.someDayPoint.in(operand, operand)),
decltype(t.someDayPoint.not_in(operand)), decltype(t.someDayPoint.not_in(operand, operand))>;
using ExpectedReturnType =
sqlpp::logic::all_t<Assert::value xor
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
@@ -66,8 +66,8 @@ namespace
void allowed_comparands()
{
static_check_comparison<sqlpp::consistent_t>(std::chrono::system_clock::now());
static_check_comparison<sqlpp::consistent_t>(t.someDate);
static_check_comparison<sqlpp::consistent_t>(t.someDateTime);
static_check_comparison<sqlpp::consistent_t>(t.someDayPoint);
static_check_comparison<sqlpp::consistent_t>(t.someTimePoint);
}
void disallowed_comparands()
+7 -7
View File
@@ -46,16 +46,16 @@ namespace
template <typename Assert, typename Operand>
void static_check_comparison(const Operand& operand)
{
using CheckResult = sqlpp::check_rhs_comparison_operand_t<decltype(t.someDateTime), Operand>;
using CheckResult = sqlpp::check_rhs_comparison_operand_t<decltype(t.someTimePoint), Operand>;
using ExpectedCheckResult = std::is_same<CheckResult, Assert>;
static_assert(ExpectedCheckResult::value, "Unexpected check result");
print_type_on_error<CheckResult>(ExpectedCheckResult{});
using ReturnType = sqlpp::detail::make_type_set_t<
decltype(t.someDateTime < operand), decltype(t.someDateTime <= operand), decltype(t.someDateTime == operand),
decltype(t.someDateTime != operand), decltype(t.someDateTime >= operand), decltype(t.someDateTime > operand),
decltype(t.someDateTime.in(operand)), decltype(t.someDateTime.in(operand, operand)),
decltype(t.someDateTime.not_in(operand)), decltype(t.someDateTime.not_in(operand, operand))>;
decltype(t.someTimePoint < operand), decltype(t.someTimePoint <= operand), decltype(t.someTimePoint == operand),
decltype(t.someTimePoint != operand), decltype(t.someTimePoint >= operand), decltype(t.someTimePoint > operand),
decltype(t.someTimePoint.in(operand)), decltype(t.someTimePoint.in(operand, operand)),
decltype(t.someTimePoint.not_in(operand)), decltype(t.someTimePoint.not_in(operand, operand))>;
using ExpectedReturnType =
sqlpp::logic::all_t<Assert::value xor
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
@@ -66,8 +66,8 @@ namespace
void allowed_comparands()
{
static_check_comparison<sqlpp::consistent_t>(std::chrono::system_clock::now());
static_check_comparison<sqlpp::consistent_t>(t.someDate);
static_check_comparison<sqlpp::consistent_t>(t.someDateTime);
static_check_comparison<sqlpp::consistent_t>(t.someDayPoint);
static_check_comparison<sqlpp::consistent_t>(t.someTimePoint);
}
void disallowed_comparands()