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

Streamlined some typenames

This commit is contained in:
Roland Bock 2013-09-29 08:51:29 +02:00
parent 3d777d982a
commit 581353dc53
3 changed files with 10 additions and 15 deletions

View File

@ -36,11 +36,6 @@
namespace sqlpp namespace sqlpp
{ {
// Hint: Columns/Values could be supported by .columns().values().values()...
// values could take values or assignments. The latter would be stripped
// The insert would store a vector of tuples of values.
// Hint: Select could be supported by perfect forwarding to the methods of _select member (always changing the whole type of the
// insert.
template< template<
typename Table = noop, typename Table = noop,
typename InsertList = noop typename InsertList = noop
@ -57,10 +52,10 @@ namespace sqlpp
static_assert(is_noop<InsertList>::value or is_insert_list_t<InsertList>::value, "invalid 'InsertList' argument"); static_assert(is_noop<InsertList>::value or is_insert_list_t<InsertList>::value, "invalid 'InsertList' argument");
template<typename... Assignment> template<typename... Assignment>
using add_insert_list_t = insert_t<Table, insert_list_t<must_not_insert_t, typename std::decay<Assignment>::type...>>; using set_insert_list_t = insert_t<Table, insert_list_t<must_not_insert_t, typename std::decay<Assignment>::type...>>;
template<typename... Assignment> template<typename... Assignment>
add_insert_list_t<Assignment...> set(Assignment&&... assignment) set_insert_list_t<Assignment...> set(Assignment&&... assignment)
{ {
static_assert(std::is_same<InsertList, noop>::value, "cannot call set() twice"); static_assert(std::is_same<InsertList, noop>::value, "cannot call set() twice");
return { return {

View File

@ -54,12 +54,12 @@ namespace sqlpp
static_assert(is_noop<Where>::value or is_where_t<Where>::value, "invalid 'Where' argument"); static_assert(is_noop<Where>::value or is_where_t<Where>::value, "invalid 'Where' argument");
template<typename... Tab> template<typename... Tab>
using add_using_t = remove_t<Table, using_t<typename std::decay<Tab>::type...>, Where>; using set_using_t = remove_t<Table, using_t<typename std::decay<Tab>::type...>, Where>;
template<typename Expr> template<typename Expr>
using add_where_t = remove_t<Table, Using, where_t<typename std::decay<Expr>::type>>; using set_where_t = remove_t<Table, Using, where_t<typename std::decay<Expr>::type>>;
template<typename... Tab> template<typename... Tab>
add_using_t<Tab...> using_(Tab&&... tab) set_using_t<Tab...> using_(Tab&&... tab)
{ {
static_assert(std::is_same<Using, noop>::value, "cannot call using() twice"); static_assert(std::is_same<Using, noop>::value, "cannot call using() twice");
static_assert(std::is_same<Where, noop>::value, "cannot call using() after where()"); static_assert(std::is_same<Where, noop>::value, "cannot call using() after where()");
@ -71,7 +71,7 @@ namespace sqlpp
} }
template<typename Expr> template<typename Expr>
add_where_t<Expr> where(Expr&& where) set_where_t<Expr> where(Expr&& where)
{ {
static_assert(std::is_same<Where, noop>::value, "cannot call where() twice"); static_assert(std::is_same<Where, noop>::value, "cannot call where() twice");
return { return {

View File

@ -54,12 +54,12 @@ namespace sqlpp
static_assert(is_noop<Where>::value or is_where_t<Where>::value, "invalid 'Where' argument"); static_assert(is_noop<Where>::value or is_where_t<Where>::value, "invalid 'Where' argument");
template<typename... Assignment> template<typename... Assignment>
using add_assignments_t = update_t<Table, assignment_list_t<must_not_update_t, typename std::decay<Assignment>::type...>, Where>; using set_assignments_t = update_t<Table, assignment_list_t<must_not_update_t, typename std::decay<Assignment>::type...>, Where>;
template<typename Expr> template<typename Expr>
using add_where_t = update_t<Table, Assignments, where_t<typename std::decay<Expr>::type>>; using set_where_t = update_t<Table, Assignments, where_t<typename std::decay<Expr>::type>>;
template<typename... Assignment> template<typename... Assignment>
add_assignments_t<Assignment...> set(Assignment&&... assignment) set_assignments_t<Assignment...> set(Assignment&&... assignment)
{ {
static_assert(std::is_same<Assignments, noop>::value, "cannot call set() twice"); static_assert(std::is_same<Assignments, noop>::value, "cannot call set() twice");
return { return {
@ -70,7 +70,7 @@ namespace sqlpp
} }
template<typename Expr> template<typename Expr>
add_where_t<Expr> where(Expr&& where) set_where_t<Expr> where(Expr&& where)
{ {
static_assert(not std::is_same<Assignments, noop>::value, "cannot call where() if set() hasn't been called yet"); static_assert(not std::is_same<Assignments, noop>::value, "cannot call where() if set() hasn't been called yet");
static_assert(std::is_same<Where, noop>::value, "cannot call where() twice"); static_assert(std::is_same<Where, noop>::value, "cannot call where() twice");