0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Fix missing space for operator-

This commit is contained in:
rbock 2019-10-09 07:25:24 +02:00
parent 268c176d8a
commit bb77cc1459
3 changed files with 21 additions and 9 deletions

View File

@ -98,6 +98,16 @@ namespace sqlpp
struct minus
{
using _traits = make_traits<ValueType>;
// The trailing space is necessary to prevent
// ```
// t.id - -1
// ```
// from turning into
// ```
// tab_sample.id--1
// ```
// (-- starts a comment in SQL)
// See https://github.com/rbock/sqlpp11/issues/294
static constexpr const char* _name = " - ";
};

View File

@ -42,7 +42,7 @@ namespace
MockDb::_serializer_context_t printer = {};
return serialize(sqlpp::value(false), printer).str();
}
}
} // namespace
int Where(int, char*[])
{
@ -53,6 +53,8 @@ int Where(int, char* [])
compare(__LINE__, select(foo.omega).from(foo).unconditionally(), "SELECT tab_foo.omega FROM tab_foo");
compare(__LINE__, remove_from(foo).unconditionally(), "DELETE FROM tab_foo");
compare(__LINE__, update(foo).set(foo.omega = 42).unconditionally(), "UPDATE tab_foo SET omega=42");
compare(__LINE__, update(foo).set(foo.omega = foo.omega - -1).unconditionally(),
"UPDATE tab_foo SET omega=(tab_foo.omega - -1)");
compare(__LINE__, where(sqlpp::value(true)), " WHERE " + getTrue());
// Never