You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that sqlpp does not support the BETWEEN operator. I suspect that adding a structure similar to is_equal_to_or_null()should be fairly easy (I mean easy for you :-)). E.g. is_between(value, lowerBound, upperBound). is_between() should accept a parameter or a field for all of its arguments.
As it is a standard ANSI operator can it make it to a coming release?
As extra motivation why it is needed there is the limitation of not being able to use the same parameter twice in query. In the equivalent expression of valueParam >= lowerBound && valueParam <= upperBound valueParam would need to be used twice which will not compile.
Currently I am hacking the system with a parameterized_verbatim, like:
sqlpp::parameterized_verbatim<sqlpp::boolean>("(", sqlpp::parameter(sqlpp::floating_point(), aValue),
" BETWEEN " + nameOf(tbl.lowerBound) + " AND " + nameOf(tbl..upperBound) + ")")
where nameOf() is
template <typename T>
inline constexpr auto nameOf()
{
return sqlpp::name_of<T>::template char_ptr<sqlpp::sqlite3::context_t>();
}
template <typename T>
std::string nameOf(T /* not used */)
{
return nameOf<T>();
}
Disclaimer: Haven't tested yet if my verbatim actually works runtime, but it at least compiles.
Cheers,
Marcell
The text was updated successfully, but these errors were encountered:
Your workaround looks reasonable at first glance. Hope it does work in practice.
Yes, adding a between function should be fairly simple. I am currently working on completing the transition to using optional consistently. I would add the operator afterwards (given that you seem to have a workaround).
Hi Roland,
It appears that sqlpp does not support the
BETWEEN
operator. I suspect that adding a structure similar tois_equal_to_or_null()
should be fairly easy (I mean easy for you :-)). E.g.is_between(value, lowerBound, upperBound)
.is_between()
should accept a parameter or a field for all of its arguments.As it is a standard ANSI operator can it make it to a coming release?
As extra motivation why it is needed there is the limitation of not being able to use the same parameter twice in query. In the equivalent expression of
valueParam >= lowerBound && valueParam <= upperBound
valueParam would need to be used twice which will not compile.Currently I am hacking the system with a
parameterized_verbatim
, like:where
nameOf()
isDisclaimer: Haven't tested yet if my verbatim actually works runtime, but it at least compiles.
Cheers,
Marcell
The text was updated successfully, but these errors were encountered: