Remove tvin

This was a special feature for a project I was working on long ago.
It provided implicit behavior for trivial value (0 or "") which were
supposed to be interpreted as NULL.
They led to `operator==` potentially being serialized as 'IS NULL'.

It makes more sense to introduce explicit helpers, e.g.

 - equal_or_is_null(col, optional)
 - not_equal_or_is_not_null(col, optional)
This commit is contained in:
Roland Bock
2021-07-11 12:47:13 +02:00
parent 35c2b9ec04
commit db0295a9d0
22 changed files with 14 additions and 286 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ int Insert(int, char* [])
compare(__LINE__, insert_into(bar).default_values(), "INSERT INTO tab_bar DEFAULT VALUES");
compare(__LINE__, insert_into(bar).set(bar.beta = "cheesecake", bar.gamma = true),
"INSERT INTO tab_bar (beta,gamma) VALUES('cheesecake'," + getTrue() + ")");
compare(__LINE__, insert_into(bar).set(bar.beta = ::sqlpp::tvin(""), bar.gamma = true),
compare(__LINE__, insert_into(bar).set(bar.beta = ::sqlpp::null, bar.gamma = true),
"INSERT INTO tab_bar (beta,gamma) VALUES(NULL," + getTrue() + ")");
#if __cplusplus >= 201703L
// string_view argument
+1 -1
View File
@@ -63,7 +63,7 @@ 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.gamma == ::sqlpp::tvin(false)), " WHERE (tab_bar.gamma 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')");
#if __cplusplus >= 201703L
// string_view argument