Prevent unconditional joins, and naked bool in where() or boolean expressions

- `.from(t1, t2)` produces an unconditional join if you forget to add a condition in the .where()
  sqlpp11 therefore now deprecates unconditional joins.
- more often than not, writing  something like `where(name == "doe")`, you
  meant to write `where(t.name == "doe")`. It is hard to find bugs when
  the former expression compiles because you happen to have a variable
  `name` in the current scope as well.
  sqlpp11 therefore now deprecates `.where(bool)` and disallows
  raw bool values boolean expression like `something and bool`
  wrap bools in sqlpp::value(), if you REALLY want a bool value here
This commit is contained in:
rbock
2016-02-25 07:57:28 +01:00
parent 6e60dc6630
commit 5e96551f83
27 changed files with 617 additions and 132 deletions

View File

@@ -63,11 +63,11 @@ int Update(int, char* [])
db(u);
db(update(t).set(t.delta = sqlpp::verbatim<sqlpp::integer>("17+4")).where(true));
db(update(t).set(t.delta = sqlpp::null).where(true));
db(update(t).set(t.delta = sqlpp::default_value).where(true));
db(update(t).set(t.delta = sqlpp::verbatim<sqlpp::integer>("17+4")).unconditionally());
db(update(t).set(t.delta = sqlpp::null).unconditionally());
db(update(t).set(t.delta = sqlpp::default_value).unconditionally());
db(update(t).set(t.delta += t.alpha * 2, t.beta += " and cake").where(true));
db(update(t).set(t.delta += t.alpha * 2, t.beta += " and cake").unconditionally());
return 0;
}