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:
parent
268c176d8a
commit
bb77cc1459
@ -98,6 +98,16 @@ namespace sqlpp
|
|||||||
struct minus
|
struct minus
|
||||||
{
|
{
|
||||||
using _traits = make_traits<ValueType>;
|
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 = " - ";
|
static constexpr const char* _name = " - ";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace
|
|||||||
MockDb::_serializer_context_t printer = {};
|
MockDb::_serializer_context_t printer = {};
|
||||||
return serialize(sqlpp::value(false), printer).str();
|
return serialize(sqlpp::value(false), printer).str();
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
int Where(int, char*[])
|
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__, 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__, 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 = 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());
|
compare(__LINE__, where(sqlpp::value(true)), " WHERE " + getTrue());
|
||||||
|
|
||||||
// Never
|
// Never
|
||||||
|
Loading…
Reference in New Issue
Block a user