From 25879d1dc03c273d19acad3955430bbf4e8e064c Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Sun, 3 Nov 2024 11:45:34 +0100 Subject: [PATCH] Use name tag instead of the whole name tag provider in paramters --- include/sqlpp11/core/basic/parameter.h | 33 +++++++++++--------------- tests/core/types/clause/cte.cpp | 2 +- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/include/sqlpp11/core/basic/parameter.h b/include/sqlpp11/core/basic/parameter.h index f81e9c69..b3ce9e23 100644 --- a/include/sqlpp11/core/basic/parameter.h +++ b/include/sqlpp11/core/basic/parameter.h @@ -34,15 +34,9 @@ namespace sqlpp { #warning: It would be sufficient to store the NameTag here, not the whole NameTagProvider - template - struct parameter_t : public enable_comparison> + template + struct parameter_t : public enable_comparison> { - using _traits = make_traits; - - using _is_literal_expression = std::true_type; - - using _instance_t = member_t>; - parameter_t() = default; parameter_t(const parameter_t&) = default; @@ -52,31 +46,32 @@ namespace sqlpp ~parameter_t() = default; }; - template - struct parameters_of> + template + struct parameters_of> { - using type = detail::type_vector>; + using type = detail::type_vector>; }; - template - struct value_type_of> + template + struct value_type_of> { using type = ValueType; }; - template - struct name_tag_of> : public name_tag_of + template + struct name_tag_of> { + using type = NameTag; }; - template - auto to_sql_string(Context& , const parameter_t&) -> std::string + template + auto to_sql_string(Context& , const parameter_t&) -> std::string { return "?"; } template - auto parameter(const NamedExpr & /*unused*/) -> parameter_t, NamedExpr> + auto parameter(const NamedExpr & /*unused*/) -> parameter_t, name_tag_of_t> { static_assert(is_selectable_t::value, "not a named expression"); return {}; @@ -84,7 +79,7 @@ namespace sqlpp template auto parameter(const ValueType& /*unused*/, const NameTagProvider & /*unused*/) - -> parameter_t, NameTagProvider> + -> parameter_t, name_tag_of_t> { static_assert(has_value_type::value, "first argument is not a value type"); static_assert(has_name_tag::value, "second argument does not have a name"); diff --git a/tests/core/types/clause/cte.cpp b/tests/core/types/clause/cte.cpp index 12ad97cd..5937a7ee 100644 --- a/tests/core/types/clause/cte.cpp +++ b/tests/core/types/clause/cte.cpp @@ -83,7 +83,7 @@ void test_cte() static_assert(std::is_same, sqlpp::detail::type_vector

>::value, ""); // CTE reference is what is stored in from_t or join_t. - // While it refers to a CTE, it cannot be used as a CTE or table, i.e. with(rx) or from(ra) would not compile. + // While it refers to a CTE, it cannot be used as a CTE or table, i.e. with(rx) or from(rx) would not compile. static_assert(not sqlpp::is_cte::value, ""); static_assert(not sqlpp::is_table::value, ""); static_assert(sqlpp::parameters_of_t::empty(), "");