0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

A few minor fixes and cleanup

This commit is contained in:
rbock 2014-07-29 09:14:51 +02:00
parent b1f1de8a08
commit c818e110b6
7 changed files with 21 additions and 8 deletions

View File

@ -162,7 +162,7 @@ namespace sqlpp
return _is_null;
}
bool is_trivial() const
bool _is_trivial() const
{
if (not _is_valid)
throw exception("accessing is_null in non-existing row");

View File

@ -161,7 +161,7 @@ namespace sqlpp
return _is_null;
}
bool is_trivial() const
bool _is_trivial() const
{
if (not _is_valid)
throw exception("accessing is_null in non-existing row");

View File

@ -162,7 +162,7 @@ namespace sqlpp
return _is_null;
}
bool is_trivial() const
bool _is_trivial() const
{
if (not _is_valid)
throw exception("accessing is_null in non-existing row");

View File

@ -63,7 +63,21 @@ namespace sqlpp
{
static bool _(const T& t)
{
return t.is_trivial();
if (null_is_trivial_value_t<T>::value)
{
return t._is_trivial();
}
else
{
if (t.is_null())
{
return false;
}
else
{
return t._is_trivial();
}
}
}
};

View File

@ -164,7 +164,7 @@ namespace sqlpp
return _value_ptr == nullptr;
}
bool is_trivial() const
bool _is_trivial() const
{
if (not _is_valid)
throw exception("accessing is_null in non-existing row");

View File

@ -155,8 +155,7 @@ namespace sqlpp
auto tvin(Operand operand) -> tvin_arg_t<typename wrap_operand<Operand>::type>
{
using _operand_t = typename wrap_operand<Operand>::type;
static_assert(std::is_same<_operand_t, text_operand>::value
or not std::is_same<_operand_t, Operand>::value, "tvin() used with invalid type (only string and primitive types allowed)");
static_assert(not std::is_same<_operand_t, Operand>::value or is_result_field_t<Operand>::value, "tvin() used with invalid type (only string and primitive types allowed)");
return {{operand}};
}

View File

@ -219,7 +219,7 @@ namespace sqlpp
};
template<typename T>
struct wrap_operand<T, typename std::enable_if<std::is_convertible<T, std::string>::value>::type>
struct wrap_operand<T, typename std::enable_if<std::is_convertible<T, std::string>::value and not is_result_field_t<T>::value>::type>
{
using type = text_operand;
};