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

Some cleanup

This commit is contained in:
Roland Bock 2024-11-14 20:18:48 +01:00
parent 89d7ed837d
commit e7fcb03ca6
15 changed files with 16 additions and 69 deletions

View File

@ -47,7 +47,6 @@ namespace sqlpp
}
};
#warning: Need to use in tests
template <typename T>
struct has_enabled_over : public std::is_base_of<enable_over<T>, T>
{

View File

@ -41,41 +41,40 @@ namespace sqlpp
public:
template <typename T>
auto join(T t) const -> decltype(::sqlpp::join(this->derived(), t))
auto join(T t) const -> decltype(::sqlpp::join(this->derived(), std::move(t)))
{
#warning: move?
return ::sqlpp::join(this->derived(), t);
return ::sqlpp::join(this->derived(), std::move(t));
}
template <typename T>
auto inner_join(T t) const -> decltype(::sqlpp::inner_join(this->derived(), t))
auto inner_join(T t) const -> decltype(::sqlpp::inner_join(this->derived(), std::move(t)))
{
return ::sqlpp::inner_join(this->derived(), t);
return ::sqlpp::inner_join(this->derived(), std::move(t));
}
template <typename T>
auto left_outer_join(T t) const -> decltype(::sqlpp::left_outer_join(this->derived(), t))
auto left_outer_join(T t) const -> decltype(::sqlpp::left_outer_join(this->derived(), std::move(t)))
{
return ::sqlpp::left_outer_join(this->derived(), t);
return ::sqlpp::left_outer_join(this->derived(), std::move(t));
}
template <typename T>
auto right_outer_join(T t) const -> decltype(::sqlpp::right_outer_join(this->derived(), t))
auto right_outer_join(T t) const -> decltype(::sqlpp::right_outer_join(this->derived(), std::move(t)))
{
return ::sqlpp::right_outer_join(this->derived(), t);
return ::sqlpp::right_outer_join(this->derived(), std::move(t));
}
#warning: There is no full_outer_join in mysql?
template <typename T>
auto full_outer_join(T t) const -> decltype(::sqlpp::full_outer_join(this->derived(), t))
auto full_outer_join(T t) const -> decltype(::sqlpp::full_outer_join(this->derived(), std::move(t)))
{
return ::sqlpp::full_outer_join(this->derived(), t);
return ::sqlpp::full_outer_join(this->derived(), std::move(t));
}
template <typename T>
auto cross_join(T t) const -> decltype(::sqlpp::cross_join(this->derived(), t))
auto cross_join(T t) const -> decltype(::sqlpp::cross_join(this->derived(), std::move(t)))
{
return ::sqlpp::cross_join(this->derived(), t);
return ::sqlpp::cross_join(this->derived(), std::move(t));
}
};
} // namespace sqlpp

View File

@ -41,11 +41,6 @@ namespace sqlpp
};
struct delete_t : public statement_name_t<delete_name_t>
{
using _traits = make_traits<no_value_t>;
struct _sqlpp_name_tag
{
};
template <typename Statement>
struct _result_methods_t
{

View File

@ -43,11 +43,6 @@ namespace sqlpp
struct insert_t : public statement_name_t<insert_name_t>
{
using _traits = make_traits<no_value_t>;
struct _sqlpp_name_tag
{
};
template <typename Statement>
struct _result_methods_t
{

View File

@ -55,14 +55,8 @@ namespace sqlpp
template <typename Table>
struct into_t
{
using _traits = make_traits<no_value_t, tag::is_into>;
using _data_t = into_data_t<Table>;
struct _sqlpp_name_tag
{
};
// Base template to be inherited by the statement
template <typename Policies>
struct _base_t

View File

@ -253,10 +253,6 @@ namespace sqlpp
{
using _traits = make_traits<no_value_t, tag::is_noop, tag::is_missing>;
struct _sqlpp_name_tag
{
};
using _data_t = no_data_t;
// Base template to be inherited by the statement

View File

@ -54,18 +54,12 @@ namespace sqlpp
template <typename Table>
struct single_table_t
{
using _traits = make_traits<no_value_t, tag::is_single_table>;
#warning: can't we do this with a table_t<> specialization
#warning: can't we do this with a table_t<> specialization?
static_assert(is_table<Table>::value, "argument has to be a table");
static_assert(required_tables_of_t<Table>::empty(), "table depends on another table");
using _data_t = single_table_data_t<Table>;
struct _sqlpp_name_tag
{
};
// Base template to be inherited by the statement
template <typename Policies>
struct _base_t

View File

@ -43,11 +43,6 @@ namespace sqlpp
struct update_t : public statement_name_t<update_name_t>
{
using _traits = make_traits<no_value_t>;
struct _sqlpp_name_tag
{
};
template <typename Statement>
struct _result_methods_t
{

View File

@ -64,7 +64,6 @@ namespace sqlpp
}
};
#warning: Why would we need this?
template <typename Exp>
using make_parameter_list_t = parameter_list_t<parameters_of_t<Exp>>;
} // namespace sqlpp

View File

@ -71,7 +71,6 @@ namespace sqlpp
template <typename Context, typename Expr>
auto to_sql_string(Context& context, const group_by_column<Expr>& t) -> std::string
{
#warning: Untested
return to_sql_string(context, t._expr);
}
@ -84,7 +83,5 @@ template <typename Expr, typename = check_declare_group_by_column_args<Expr>>
return {std::move(expr)};
}
#warning Add tests
} // namespace sqlpp11

View File

@ -35,13 +35,6 @@ namespace sqlpp
struct noop
{
#warning: All this should go away
using _traits = make_traits<no_value_t, tag::is_noop>;
using _nodes = detail::type_vector<>;
struct _sqlpp_name_tag
{
};
template <typename Statement>
struct _result_methods_t
{

View File

@ -40,7 +40,5 @@ namespace sqlpp
{
};
#warning Add tests
} // namespace sqlpp11

View File

@ -218,11 +218,6 @@ namespace sqlpp
struct no_returning_column_list_t
{
using _traits = make_traits<no_value_t, tag::is_noop, tag::is_missing>;
using _nodes = ::sqlpp::detail::type_vector<>;
struct _sqlpp_name_tag
{
};
// Data
using _data_t = no_data_t;

View File

@ -49,11 +49,6 @@ namespace sqlpp
template <typename InsertOrAlternative>
struct insert_or_t : public statement_name_t<InsertOrAlternative>
{
using _traits = make_traits<no_value_t>;
struct _sqlpp_name_tag
{
};
template <typename Statement>
struct _result_methods_t
{

View File

@ -40,6 +40,9 @@ void test_group_by()
auto col_int = test::TabFoo{}.id;
auto col_txt = test::TabFoo{}.textNnD;
// Test that declared group by columns are considered group by columns
static_assert(sqlpp::is_group_by_column<decltype(declare_group_by_column(v))>::value, "");
// Constant values are neutral and therefore considered neither aggregate and non-aggregate.
static_assert(decltype(known_aggregate_columns_as_expected(col_int))::value, "");
static_assert(decltype(known_aggregate_columns_as_expected(col_int, col_txt))::value, "");