mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Aligned structure of connector traits with other traits
This commit is contained in:
parent
6d851f17ff
commit
643aab222e
@ -109,7 +109,7 @@ namespace sqlpp
|
|||||||
template<typename Db, typename FieldSpec>
|
template<typename Db, typename FieldSpec>
|
||||||
struct field_methods_t<
|
struct field_methods_t<
|
||||||
_result_field_t<Db, FieldSpec>,
|
_result_field_t<Db, FieldSpec>,
|
||||||
typename std::enable_if<connector_enforce_null_result_treatment_t<Db>::value
|
typename std::enable_if<enforce_null_result_treatment_t<Db>::value
|
||||||
and column_spec_can_be_null_t<FieldSpec>::value
|
and column_spec_can_be_null_t<FieldSpec>::value
|
||||||
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
||||||
{
|
{
|
||||||
@ -166,7 +166,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
if (_is_null)
|
if (_is_null)
|
||||||
{
|
{
|
||||||
if (connector_enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
if (enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
||||||
{
|
{
|
||||||
throw exception("accessing value of NULL field");
|
throw exception("accessing value of NULL field");
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ namespace sqlpp
|
|||||||
template<typename Db, typename FieldSpec>
|
template<typename Db, typename FieldSpec>
|
||||||
struct field_methods_t<
|
struct field_methods_t<
|
||||||
_result_field_t<Db, FieldSpec>,
|
_result_field_t<Db, FieldSpec>,
|
||||||
typename std::enable_if<connector_enforce_null_result_treatment_t<Db>::value
|
typename std::enable_if<enforce_null_result_treatment_t<Db>::value
|
||||||
and column_spec_can_be_null_t<FieldSpec>::value
|
and column_spec_can_be_null_t<FieldSpec>::value
|
||||||
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
if (_is_null)
|
if (_is_null)
|
||||||
{
|
{
|
||||||
if (connector_enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
if (enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
||||||
{
|
{
|
||||||
throw exception("accessing value of NULL field");
|
throw exception("accessing value of NULL field");
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ namespace sqlpp
|
|||||||
template<typename Db, typename FieldSpec>
|
template<typename Db, typename FieldSpec>
|
||||||
struct field_methods_t<
|
struct field_methods_t<
|
||||||
_result_field_t<Db, FieldSpec>,
|
_result_field_t<Db, FieldSpec>,
|
||||||
typename std::enable_if<connector_enforce_null_result_treatment_t<Db>::value
|
typename std::enable_if<enforce_null_result_treatment_t<Db>::value
|
||||||
and column_spec_can_be_null_t<FieldSpec>::value
|
and column_spec_can_be_null_t<FieldSpec>::value
|
||||||
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
||||||
{
|
{
|
||||||
@ -167,7 +167,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
if (_is_null)
|
if (_is_null)
|
||||||
{
|
{
|
||||||
if (connector_enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
if (enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
||||||
{
|
{
|
||||||
throw exception("accessing value of NULL field");
|
throw exception("accessing value of NULL field");
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ namespace sqlpp
|
|||||||
template<typename Db, typename FieldSpec>
|
template<typename Db, typename FieldSpec>
|
||||||
struct field_methods_t<
|
struct field_methods_t<
|
||||||
_result_field_t<Db, FieldSpec>,
|
_result_field_t<Db, FieldSpec>,
|
||||||
typename std::enable_if<connector_enforce_null_result_treatment_t<Db>::value
|
typename std::enable_if<enforce_null_result_treatment_t<Db>::value
|
||||||
and column_spec_can_be_null_t<FieldSpec>::value
|
and column_spec_can_be_null_t<FieldSpec>::value
|
||||||
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
and not null_is_trivial_value_t<FieldSpec>::value>::type>
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
if (not _value_ptr)
|
if (not _value_ptr)
|
||||||
{
|
{
|
||||||
if (connector_enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
if (enforce_null_result_treatment_t<Db>::value and not null_is_trivial_value_t<FieldSpec>::value)
|
||||||
{
|
{
|
||||||
throw exception("accessing value of NULL field");
|
throw exception("accessing value of NULL field");
|
||||||
}
|
}
|
||||||
|
@ -97,17 +97,6 @@ namespace sqlpp
|
|||||||
template<typename T>\
|
template<typename T>\
|
||||||
struct name##_t: detail::name##_impl<T> {};
|
struct name##_t: detail::name##_impl<T> {};
|
||||||
|
|
||||||
#define SQLPP_CONNECTOR_TRAIT_GENERATOR(name) \
|
|
||||||
namespace detail\
|
|
||||||
{\
|
|
||||||
template<typename T, typename Enable = void>\
|
|
||||||
struct connector_##name##_impl: std::false_type {};\
|
|
||||||
template<typename T>\
|
|
||||||
struct connector_##name##_impl<T, typename std::enable_if<std::is_same<typename T::_tags::_##name, std::true_type>::value>::type>: std::true_type {};\
|
|
||||||
}\
|
|
||||||
template<typename T>\
|
|
||||||
struct connector_##name##_t: detail::connector_##name##_impl<T> {};
|
|
||||||
|
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(boolean);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(boolean);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(integral);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(integral);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(floating_point);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(floating_point);
|
||||||
@ -174,7 +163,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(requires_braces);
|
SQLPP_TYPE_TRAIT_GENERATOR(requires_braces);
|
||||||
|
|
||||||
SQLPP_CONNECTOR_TRAIT_GENERATOR(enforce_null_result_treatment);
|
SQLPP_VALUE_TRAIT_GENERATOR(enforce_null_result_treatment);
|
||||||
|
|
||||||
template<typename Database>
|
template<typename Database>
|
||||||
using is_database = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using is_database = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
|
@ -33,10 +33,8 @@
|
|||||||
template<bool enforceNullResultTreatment>
|
template<bool enforceNullResultTreatment>
|
||||||
struct MockDbT: public sqlpp::connection
|
struct MockDbT: public sqlpp::connection
|
||||||
{
|
{
|
||||||
struct _tags
|
using _traits = ::sqlpp::make_traits<::sqlpp::no_value_t,
|
||||||
{
|
typename std::conditional<enforceNullResultTreatment, ::sqlpp::tag::enforce_null_result_treatment, void>::type>;
|
||||||
using _enforce_null_result_treatment = std::integral_constant<bool, enforceNullResultTreatment>;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _serializer_context_t
|
struct _serializer_context_t
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user