Add is_equal_or_null(col, some_value_or_null)

This replaces the former implicit tvin logic with an explicit function.
This commit is contained in:
Roland Bock
2021-07-25 15:22:12 +02:00
parent 135db9397b
commit d68744c432
5 changed files with 94 additions and 3 deletions

View File

@@ -63,8 +63,11 @@ int Where(int, char*[])
// Sometimes
compare(__LINE__, where(bar.gamma), " WHERE tab_bar.gamma");
compare(__LINE__, where(bar.gamma == false), " WHERE (tab_bar.gamma=" + getFalse() + ")");
compare(__LINE__, where(bar.beta.is_null()), " WHERE tab_bar.beta IS NULL");
compare(__LINE__, where(bar.beta.is_null()), " WHERE (tab_bar.beta IS NULL)");
compare(__LINE__, where(bar.beta == "SQL"), " WHERE (tab_bar.beta='SQL')");
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null("SQL"))), " WHERE (tab_bar.beta='SQL')");
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null<sqlpp::text>(::sqlpp::null))),
" WHERE (tab_bar.beta IS NULL)");
#if __cplusplus >= 201703L
// string_view argument
std::string_view sqlString = "SQL";