0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Removed the add_ntc functions (use without_table_check)

This commit is contained in:
rbock 2016-03-16 18:26:51 +01:00
parent 201b060d24
commit f3bd2f01ab
8 changed files with 13 additions and 61 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2015, Roland Bock * Copyright (c) 2013-2016, Roland Bock
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -85,17 +85,11 @@ namespace sqlpp
} }
template <typename Expression> template <typename Expression>
void add_ntc(Expression expression)
{
add<Expression, std::false_type>(expression);
}
template <typename Expression, typename TableCheckRequired = std::true_type>
void add(Expression expression) void add(Expression expression)
{ {
static_assert(_is_dynamic::value, "add() must not be called for static group_by"); static_assert(_is_dynamic::value, "add() must not be called for static group_by");
static_assert(is_expression_t<Expression>::value, "invalid expression argument in group_by::add()"); static_assert(is_expression_t<Expression>::value, "invalid expression argument in group_by::add()");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<Expression>::value, static_assert(Policies::template _no_unknown_tables<Expression>::value,
"expression uses tables unknown to this statement in group_by::add()"); "expression uses tables unknown to this statement in group_by::add()");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expression>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expression>;
_serialize_check::_(); _serialize_check::_();

View File

@ -82,17 +82,11 @@ namespace sqlpp
} }
template <typename Expr> template <typename Expr>
void add_ntc(Expr expression)
{
add<Expr, std::false_type>(expression);
}
template <typename Expr, typename TableCheckRequired = std::true_type>
void add(Expr expression) void add(Expr expression)
{ {
static_assert(_is_dynamic::value, "having::add() can only be called for dynamic_having"); static_assert(_is_dynamic::value, "having::add() can only be called for dynamic_having");
static_assert(is_expression_t<Expr>::value, "invalid expression argument in having::add()"); static_assert(is_expression_t<Expr>::value, "invalid expression argument in having::add()");
static_assert(not TableCheckRequired::value or Policies::template _no_unknown_tables<Expr>::value, static_assert(Policies::template _no_unknown_tables<Expr>::value,
"expression uses tables unknown to this statement in having::add()"); "expression uses tables unknown to this statement in having::add()");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expr>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expr>;
_serialize_check::_(); _serialize_check::_();

View File

@ -252,12 +252,6 @@ namespace sqlpp
} }
template <typename Assignment> template <typename Assignment>
void add_ntc(Assignment assignment)
{
add<Assignment, std::false_type>(assignment);
}
template <typename Assignment, typename TableCheckRequired = std::true_type>
void add(Assignment assignment) void add(Assignment assignment)
{ {
static_assert(_is_dynamic::value, "add must not be called for static from()"); static_assert(_is_dynamic::value, "add must not be called for static from()");
@ -266,7 +260,7 @@ namespace sqlpp
static_assert(not detail::is_element_of<lhs_t<Assignment>, _assigned_columns>::value, static_assert(not detail::is_element_of<lhs_t<Assignment>, _assigned_columns>::value,
"Must not assign value to column twice"); "Must not assign value to column twice");
static_assert(not must_not_insert_t<lhs_t<Assignment>>::value, "add() argument must not be used in insert"); static_assert(not must_not_insert_t<lhs_t<Assignment>>::value, "add() argument must not be used in insert");
static_assert(not TableCheckRequired::value or Policies::template _no_unknown_tables<Assignment>::value, static_assert(Policies::template _no_unknown_tables<Assignment>::value,
"add() contains a column from a foreign table"); "add() contains a column from a foreign table");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Assignment>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Assignment>;
_serialize_check::_(); _serialize_check::_();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2015, Roland Bock * Copyright (c) 2013-2016, Roland Bock
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -82,17 +82,11 @@ namespace sqlpp
} }
template <typename Expression> template <typename Expression>
void add_ntc(Expression expression)
{
add<Expression, std::false_type>(expression);
}
template <typename Expression, typename TableCheckRequired = std::true_type>
void add(Expression expression) void add(Expression expression)
{ {
static_assert(_is_dynamic::value, "add() must not be called for static order_by"); static_assert(_is_dynamic::value, "add() must not be called for static order_by");
static_assert(is_sort_order_t<Expression>::value, "invalid expression argument in order_by::add()"); static_assert(is_sort_order_t<Expression>::value, "invalid expression argument in order_by::add()");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<Expression>::value, static_assert(Policies::template _no_unknown_tables<Expression>::value,
"expression uses tables unknown to this statement in order_by::add()"); "expression uses tables unknown to this statement in order_by::add()");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expression>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Expression>;
_serialize_check::_(); _serialize_check::_();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2015, Roland Bock * Copyright (c) 2013-2016, Roland Bock
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -123,19 +123,13 @@ namespace sqlpp
} }
template <typename NamedExpression> template <typename NamedExpression>
void add_ntc(NamedExpression namedExpression)
{
add<NamedExpression, std::false_type>(namedExpression);
}
template <typename NamedExpression, typename TableCheckRequired = std::true_type>
void add(NamedExpression namedExpression) void add(NamedExpression namedExpression)
{ {
using named_expression = auto_alias_t<NamedExpression>; using named_expression = auto_alias_t<NamedExpression>;
static_assert(_is_dynamic::value, "selected_columns::add() can only be called for dynamic_column"); static_assert(_is_dynamic::value, "selected_columns::add() can only be called for dynamic_column");
static_assert(is_selectable_t<named_expression>::value, static_assert(is_selectable_t<named_expression>::value,
"invalid named expression argument in selected_columns::add()"); "invalid named expression argument in selected_columns::add()");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<named_expression>::value, static_assert(Policies::template _no_unknown_tables<named_expression>::value,
"named expression uses tables unknown to this statement in selected_columns::add()"); "named expression uses tables unknown to this statement in selected_columns::add()");
using column_names = detail::make_type_set_t<typename Columns::_alias_t...>; using column_names = detail::make_type_set_t<typename Columns::_alias_t...>;
static_assert(not detail::is_element_of<typename named_expression::_alias_t, column_names>::value, static_assert(not detail::is_element_of<typename named_expression::_alias_t, column_names>::value,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2015, Roland Bock * Copyright (c) 2013-2016, Roland Bock
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -78,17 +78,11 @@ namespace sqlpp
} }
template <typename Flag> template <typename Flag>
void add_ntc(Flag flag)
{
add<Flag, std::false_type>(flag);
}
template <typename Flag, typename TableCheckRequired = std::true_type>
void add(Flag flag) void add(Flag flag)
{ {
static_assert(_is_dynamic::value, "select_flags::add() must not be called for static select flags"); static_assert(_is_dynamic::value, "select_flags::add() must not be called for static select flags");
static_assert(is_select_flag_t<Flag>::value, "invalid select flag argument in select_flags::add()"); static_assert(is_select_flag_t<Flag>::value, "invalid select flag argument in select_flags::add()");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<Flag>::value, static_assert(Policies::template _no_unknown_tables<Flag>::value,
"flag uses tables unknown to this statement in select_flags::add()"); "flag uses tables unknown to this statement in select_flags::add()");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Flag>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Flag>;
_serialize_check::_(); _serialize_check::_();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2015, Roland Bock * Copyright (c) 2013-2016, Roland Bock
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -78,12 +78,6 @@ namespace sqlpp
} }
template <typename Assignment> template <typename Assignment>
void add_ntc(Assignment assignment)
{
add<Assignment, std::false_type>(assignment);
}
template <typename Assignment, typename TableCheckRequired = std::true_type>
void add(Assignment assignment) void add(Assignment assignment)
{ {
static_assert(_is_dynamic::value, "add must not be called for static from()"); static_assert(_is_dynamic::value, "add must not be called for static from()");
@ -92,7 +86,7 @@ namespace sqlpp
static_assert(not detail::is_element_of<lhs_t<Assignment>, _assigned_columns>::value, static_assert(not detail::is_element_of<lhs_t<Assignment>, _assigned_columns>::value,
"Must not assign value to column twice"); "Must not assign value to column twice");
static_assert(logic::not_t<must_not_update_t, lhs_t<Assignment>>::value, "add() argument must not be updated"); static_assert(logic::not_t<must_not_update_t, lhs_t<Assignment>>::value, "add() argument must not be updated");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<Assignment>::value, static_assert(Policies::template _no_unknown_tables<Assignment>::value,
"assignment uses tables unknown to this statement in add()"); "assignment uses tables unknown to this statement in add()");
using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Assignment>; using _serialize_check = sqlpp::serialize_check_t<typename Database::_serializer_context_t, Assignment>;
_serialize_check::_(); _serialize_check::_();

View File

@ -84,18 +84,12 @@ namespace sqlpp
} }
template <typename Expr> template <typename Expr>
void add_ntc(Expr expression)
{
add<Expr, std::false_type>(expression);
}
template <typename Expr, typename TableCheckRequired = std::true_type>
void add(Expr expression) void add(Expr expression)
{ {
static_assert(_is_dynamic::value, "where::add() can only be called for dynamic_where"); static_assert(_is_dynamic::value, "where::add() can only be called for dynamic_where");
static_assert(is_expression_t<Expr>::value, "invalid expression argument in where::add()"); static_assert(is_expression_t<Expr>::value, "invalid expression argument in where::add()");
static_assert(is_boolean_t<Expr>::value, "invalid expression argument in where::add()"); static_assert(is_boolean_t<Expr>::value, "invalid expression argument in where::add()");
static_assert(not TableCheckRequired::value or Policies::template _no_unknown_tables<Expr>::value, static_assert(Policies::template _no_unknown_tables<Expr>::value,
"expression uses tables unknown to this statement in where::add()"); "expression uses tables unknown to this statement in where::add()");
static_assert(not contains_aggregate_function_t<Expr>::value, static_assert(not contains_aggregate_function_t<Expr>::value,
"where expression must not contain aggregate functions"); "where expression must not contain aggregate functions");