diff --git a/include/sqlpp11/aggregate_functions/max.h b/include/sqlpp11/aggregate_functions/max.h index b6d72273..7077d06f 100644 --- a/include/sqlpp11/aggregate_functions/max.h +++ b/include/sqlpp11/aggregate_functions/max.h @@ -31,40 +31,16 @@ namespace sqlpp { - struct max_alias_t - { - struct _alias_t - { - static constexpr const char _literal[] = "max_"; - using _name_t = sqlpp::make_char_sequence; - template - struct _member_t - { - T max; - T& operator()() - { - return max; - } - const T& operator()() const - { - return max; - } - }; - }; - }; - template - struct max_t : public expression_operators, value_type_of>, + struct max_t : public expression_operators, value_type_of_t>, public aggregate_function_operators>, public alias_operators> { - using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _traits = make_traits, tag::is_expression, tag::is_selectable>; using _nodes = detail::type_vector; using _can_be_null = std::true_type; using _is_aggregate_expression = std::true_type; - using _auto_alias_t = max_alias_t; - max_t(Expr expr) : _expr(expr) { } @@ -93,20 +69,18 @@ namespace sqlpp } template - auto max(T t) -> max_t> + using check_max_arg = + std::enable_if_t::value and not contains_aggregate_function_t::value>; + + template > + auto max(T t) -> max_t { - static_assert(not contains_aggregate_function_t>::value, - "max() cannot be used on an aggregate function"); - static_assert(is_expression_t>::value, "max() requires an expression as argument"); - return {t}; + return {std::move(t)}; } - template - auto max(const distinct_t& /*unused*/, T t) -> max_t> + template > + auto max(const distinct_t& /*unused*/, T t) -> max_t { - static_assert(not contains_aggregate_function_t>::value, - "max() cannot be used on an aggregate function"); - static_assert(is_expression_t>::value, "max() requires an expression as argument"); - return {t}; + return {std::move(t)}; } } // namespace sqlpp diff --git a/include/sqlpp11/aggregate_functions/min.h b/include/sqlpp11/aggregate_functions/min.h index d3bb8250..c6432bc1 100644 --- a/include/sqlpp11/aggregate_functions/min.h +++ b/include/sqlpp11/aggregate_functions/min.h @@ -54,11 +54,11 @@ namespace sqlpp }; template - struct min_t : public expression_operators, value_type_of>, + struct min_t : public expression_operators, value_type_of_t>, public aggregate_function_operators>, public alias_operators> { - using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _traits = make_traits, tag::is_expression, tag::is_selectable>; using _nodes = detail::type_vector; using _can_be_null = std::true_type; using _is_aggregate_expression = std::true_type; diff --git a/include/sqlpp11/aggregate_functions/sum.h b/include/sqlpp11/aggregate_functions/sum.h index 05f5866e..c299f7f4 100644 --- a/include/sqlpp11/aggregate_functions/sum.h +++ b/include/sqlpp11/aggregate_functions/sum.h @@ -54,11 +54,11 @@ namespace sqlpp }; template - struct sum_t : public expression_operators, value_type_of>, + struct sum_t : public expression_operators, value_type_of_t>, public aggregate_function_operators>, public alias_operators> { - using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _traits = make_traits, tag::is_expression, tag::is_selectable>; using _nodes = detail::type_vector; using _can_be_null = std::true_type; using _is_aggregate_expression = std::true_type; diff --git a/include/sqlpp11/alias.h b/include/sqlpp11/alias.h index 59b19e44..65535596 100644 --- a/include/sqlpp11/alias.h +++ b/include/sqlpp11/alias.h @@ -33,11 +33,14 @@ namespace sqlpp template struct expression_alias_t { - using _traits = make_traits, tag::is_selectable, tag::is_alias>; + using _traits = make_traits, tag::is_selectable, tag::is_alias>; using _nodes = detail::type_vector; +#warning Maybe make constructor of expressions private to force construction in the respective functions? + /* static_assert(is_expression_t::value, "invalid argument for an expression alias"); static_assert(not is_alias_t::value, "cannot create an alias of an alias"); + */ using _alias_t = typename AliasProvider::_alias_t; @@ -59,6 +62,12 @@ namespace sqlpp Expression _expression; }; + template + struct value_type_of> + { + using type = value_type_of_t; + }; + template Context& serialize(const expression_alias_t& t, Context& context) { diff --git a/include/sqlpp11/any.h b/include/sqlpp11/any.h index e7ee88e8..6aba53fb 100644 --- a/include/sqlpp11/any.h +++ b/include/sqlpp11/any.h @@ -35,7 +35,7 @@ namespace sqlpp template struct any_t { - using _traits = make_traits, tag::is_multi_expression>; + using _traits = make_traits, tag::is_multi_expression>; using _nodes = detail::type_vector; - using _can_be_null = std::false_type; - - static_assert(is_select_t& t, Context& context) - { - context << "EXISTS"; - serialize_operand(t._select, context); - return context; - } - - template - auto exists(T t) -> exists_t> - { - static_assert(is_select_t>::value, "exists() requires a select expression as argument"); - return {t}; - } -} // namespace sqlpp diff --git a/include/sqlpp11/expression.h b/include/sqlpp11/expression.h index 17e71eb6..3db047dd 100644 --- a/include/sqlpp11/expression.h +++ b/include/sqlpp11/expression.h @@ -137,10 +137,10 @@ namespace sqlpp } template - struct binary_expression_t : public expression_operators, value_type_of>, + struct binary_expression_t : public expression_operators, value_type_of_t>, public alias_operators> { - using _traits = make_traits, tag::is_expression>; + using _traits = make_traits, tag::is_expression>; using _nodes = detail::type_vector; binary_expression_t(Lhs lhs, Rhs rhs) : _lhs(lhs), _rhs(rhs) @@ -169,10 +169,10 @@ namespace sqlpp } template - struct unary_expression_t : public expression_operators, value_type_of>, + struct unary_expression_t : public expression_operators, value_type_of_t>, public alias_operators> { - using _traits = make_traits, tag::is_expression>; + using _traits = make_traits, tag::is_expression>; using _nodes = detail::type_vector; unary_expression_t(Rhs rhs) : _rhs(rhs) diff --git a/include/sqlpp11/expression_return_types.h b/include/sqlpp11/expression_return_types.h index b1048f0c..c095cd52 100644 --- a/include/sqlpp11/expression_return_types.h +++ b/include/sqlpp11/expression_return_types.h @@ -97,7 +97,7 @@ namespace sqlpp struct return_type_plus { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_plus_t = typename return_type_plus::type; @@ -106,7 +106,7 @@ namespace sqlpp struct return_type_minus { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_minus_t = typename return_type_minus::type; @@ -115,7 +115,7 @@ namespace sqlpp struct return_type_multiplies { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_multiplies_t = typename return_type_multiplies::type; @@ -124,7 +124,7 @@ namespace sqlpp struct return_type_divides { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_divides_t = typename return_type_divides::type; @@ -133,7 +133,7 @@ namespace sqlpp struct return_type_modulus { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_modulus_t = typename return_type_modulus::type; @@ -142,7 +142,7 @@ namespace sqlpp struct return_type_unary_plus { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_unary_plus_t = typename return_type_unary_plus::type; @@ -151,7 +151,7 @@ namespace sqlpp struct return_type_unary_minus { using check = assert_valid_operands; - using type = bad_expression>; + using type = bad_expression>; }; template using return_type_unary_minus_t = typename return_type_unary_minus::type; diff --git a/include/sqlpp11/field_spec.h b/include/sqlpp11/field_spec.h index 7ba5ae83..96a19c6b 100644 --- a/include/sqlpp11/field_spec.h +++ b/include/sqlpp11/field_spec.h @@ -37,11 +37,6 @@ namespace sqlpp template struct field_spec_t { - using _traits = make_traits>; - using _nodes = detail::type_vector<>; - using _alias_t = NameType; using cpp_type = typename std::conditional; - static constexpr bool _can_be_null = is_optional::value or can_be_null_t::value; + using ValueType = value_type_of_t; + static constexpr bool _can_be_null = is_optional::value or is_optional::value; static constexpr bool _depends_on_outer_table = detail::make_intersect_set_t, typename Select::_used_outer_tables>::size::value > 0; using type = field_spec_t, + remove_optional_t, logic::any_t<_can_be_null, _depends_on_outer_table>::value>; }; } // namespace detail diff --git a/include/sqlpp11/functions.h b/include/sqlpp11/functions.h index acf0e680..b2f0d41e 100644 --- a/include/sqlpp11/functions.h +++ b/include/sqlpp11/functions.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +53,7 @@ namespace sqlpp { template - auto flatten(const Expression& exp, Db& db) -> verbatim_t> + auto flatten(const Expression& exp, Db& db) -> verbatim_t> { static_assert(not make_parameter_list_t::size::value, "parameters are not allowed in flattened expressions"); diff --git a/include/sqlpp11/insert_value.h b/include/sqlpp11/insert_value.h index e7ed389c..259e0958 100644 --- a/include/sqlpp11/insert_value.h +++ b/include/sqlpp11/insert_value.h @@ -58,7 +58,7 @@ namespace sqlpp { using _is_insert_value = std::true_type; using _column_t = Column; - using _pure_value_t = typename value_type_of::_cpp_value_type; + using _pure_value_t = typename value_type_of_t::_cpp_value_type; using _wrapped_value_t = wrap_operand_t<_pure_value_t>; using _value_or_null_t = value_or_null_t; diff --git a/include/sqlpp11/insert_value_list.h b/include/sqlpp11/insert_value_list.h index 0e2e7e04..9f103865 100644 --- a/include/sqlpp11/insert_value_list.h +++ b/include/sqlpp11/insert_value_list.h @@ -138,8 +138,6 @@ namespace sqlpp SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_set_assignments_t, "at least one argument is not an assignment in set()"); SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_set_no_duplicates_t, "at least one duplicate column detected in set()"); - SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_set_allowed_t, - "at least one assignment is prohibited by its column definition in set()"); SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_set_single_table_t, "set() arguments contain assignments from more than one table"); SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_static_set_count_args_t, @@ -149,31 +147,12 @@ namespace sqlpp SQLPP_PORTABLE_STATIC_ASSERT(assert_insert_dynamic_set_statement_dynamic_t, "dynamic_set must not be called in a static statement"); - // workaround for msvc bugs https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269 & - // https://connect.microsoft.com/VisualStudio/Feedback/Details/2173198 - // template - // using check_insert_set_t = static_combined_check_t< - // static_check_t::value...>::value, assert_insert_set_assignments_t>, - // static_check_t...>::value, assert_insert_set_no_duplicates_t>, - // static_check_t>::value...>::value, - // assert_insert_set_allowed_t>, - // static_check_t>...>::size::value == 1, - // assert_insert_set_single_table_t>>; - - template - struct must_not_insert - { - static const bool value = must_not_insert_t>::value; - }; - template using check_insert_set_t = static_combined_check_t< static_check_t::type::value...>::value, assert_insert_set_assignments_t>, static_check_t::type...>::value, assert_insert_set_no_duplicates_t>, - static_check_t::value...>::value, assert_insert_set_allowed_t>, static_check_t::type>...>::size::value == 1, assert_insert_set_single_table_t>>; @@ -382,8 +361,6 @@ namespace sqlpp { static_assert(not detail::has_duplicates::value, "at least one duplicate argument detected in columns()"); - static_assert(logic::none_t::value...>::value, - "at least one column argument has a must_not_insert tag in its definition"); using _column_required_tables = detail::make_joined_set_t...>; static_assert(_column_required_tables::size::value == 1, "columns() contains columns from several tables"); diff --git a/include/sqlpp11/is_equal_to_or_null.h b/include/sqlpp11/is_equal_to_or_null.h index 3e17f2e1..72096b37 100644 --- a/include/sqlpp11/is_equal_to_or_null.h +++ b/include/sqlpp11/is_equal_to_or_null.h @@ -68,7 +68,7 @@ namespace sqlpp { static_assert(is_expression_t::value, "is_equal_to_or_null() is to be called an expression (e.g. a column) and a value_or_null expression"); - static_assert(std::is_same, ValueType>::value, + static_assert(std::is_same, ValueType>::value, "is_equal_to_or_null() arguments need to have the same value type"); return {expr, value}; } diff --git a/include/sqlpp11/logical_expression.h b/include/sqlpp11/logical_expression.h new file mode 100644 index 00000000..2497bc29 --- /dev/null +++ b/include/sqlpp11/logical_expression.h @@ -0,0 +1,123 @@ +#pragma once + +/* +Copyright (c) 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include +//#include +//#include +//#include +#include +//#include + +namespace sqlpp +{ + template + struct logical_expression + { + logical_expression() = delete; + constexpr logical_expression(L l, R r) : _l(l), _r(r) + { + } + logical_expression(const logical_expression&) = default; + logical_expression(logical_expression&&) = default; + logical_expression& operator=(const logical_expression&) = default; + logical_expression& operator=(logical_expression&&) = default; + ~logical_expression() = default; + + template + expression_alias_t as(const alias_provider& /*unused*/) const + { + return {*this}; + } + + L _l; + R _r; + }; + + template + struct unary_logical_expression + { + unary_logical_expression() = delete; + constexpr unary_logical_expression(R r) : _r(r) + { + } + unary_logical_expression(const unary_logical_expression&) = default; + unary_logical_expression(unary_logical_expression&&) = default; + unary_logical_expression& operator=(const unary_logical_expression&) = default; + unary_logical_expression& operator=(unary_logical_expression&&) = default; + ~unary_logical_expression() = default; + + template + expression_alias_t as(const alias_provider& /*unused*/) const + { + return {*this}; + } + + R _r; + }; + + template + using check_logical_args = std::enable_if_t::value and has_boolean_value::value>; + + /* + template + struct nodes_of> + { + using type = type_vector; + }; + + template + struct value_type_of_t> + { + using type = bool; + }; + + template + constexpr auto requires_braces_v> = true; + + template + [[nodiscard]] auto to_sql_string(Context& context, const logical_binary_expression& t) + { + return to_sql_string(context, embrace(t._l)) + Operator::symbol + to_sql_string(context, embrace(t._r)); + } + + template + [[nodiscard]] auto to_sql_string(Context& context, const logical_binary_expression& t) + { + return Operator::symbol + to_sql_string(context, embrace(t._r)); + } + + template + [[nodiscard]] auto to_sql_string(Context& context, const logical_binary_expression, Operator, R2>& t) + { + return to_sql_string(context, t._l) + Operator::symbol + to_sql_string(context, embrace(t._r)); + } + */ + +} // namespace sqlpp diff --git a/include/sqlpp11/operator.h b/include/sqlpp11/operator.h new file mode 100644 index 00000000..8c9091a0 --- /dev/null +++ b/include/sqlpp11/operator.h @@ -0,0 +1,83 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* Hint + Most operators are using enable_if instead of wrapped static_assert. + This is because variants with static_assert would enter the overload + set and cause havoc. + */ + +// logical +#include +#include +#include + +// comparison +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// arithmetic +#include +#include +#include +#include +#include +#include + +// binary +#include +#include +#include +#include +#include +#include + +// assignment +#include + +// misc +#include + +#include +#include +#include + +#include +#include + +#include diff --git a/include/sqlpp11/operator/as.h b/include/sqlpp11/operator/as.h new file mode 100644 index 00000000..2089f214 --- /dev/null +++ b/include/sqlpp11/operator/as.h @@ -0,0 +1,47 @@ +#pragma once + +/* +Copyright (c) 2017, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include +#include + +namespace sqlpp +{ + template + using check_as_args = std::enable_if_t< + is_expression_t::value and not is_alias_t::value and has_name::value + >; + + template > + constexpr auto as(Expr expr, const AliasProvider&) -> expression_alias_t + { + return {std::move(expr)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/asc.h b/include/sqlpp11/operator/asc.h new file mode 100644 index 00000000..71ae28d7 --- /dev/null +++ b/include/sqlpp11/operator/asc.h @@ -0,0 +1,39 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + template > + constexpr auto asc(L l) -> sort_order_expression + { + return {l, sort_order::asc}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/assign.h b/include/sqlpp11/operator/assign.h new file mode 100644 index 00000000..444ff5ae --- /dev/null +++ b/include/sqlpp11/operator/assign.h @@ -0,0 +1,82 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include +#include + +namespace sqlpp +{ + template + struct assign_expression + { + L column; + R value; + }; + +#warning rename is_column, is_default, values_are_comparable -> values_are_compatible +#warning document the change that there is no read-only! +#warning handle default_t, but only if the column does have a default! + template + using check_assign_args = std::enable_if_t::value and values_are_comparable::value and + (can_be_null_t::value or not is_optional::value) and + (has_default_t::value or not std::is_same::value)>; + + template > + constexpr auto assign(L column, R value) -> assign_expression + { + return {std::move(column), std::move(value)}; + } + + /* + template + struct nodes_of> + { + using type = type_vector; + }; + + template + constexpr auto is_assignment_v> = true; + + template + struct column_of> + { + using type = L; + }; + + template + constexpr auto requires_braces_v> = true; + + template + [[nodiscard]] auto to_sql_string(Context& context, const assign_t& t) + { + return to_sql_string(context, t.column) + " = " + to_sql_string(context, embrace(t.value)); + } + */ +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_and.h b/include/sqlpp11/operator/bit_and.h new file mode 100644 index 00000000..6b74b25e --- /dev/null +++ b/include/sqlpp11/operator/bit_and.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_and + { + static constexpr auto symbol = " & "; + }; + + template > + constexpr auto operator&(L l, R r) -> bit_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_not.h b/include/sqlpp11/operator/bit_not.h new file mode 100644 index 00000000..bcfe9be6 --- /dev/null +++ b/include/sqlpp11/operator/bit_not.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_not + { + static constexpr auto symbol = "~"; + }; + + template > + constexpr auto operator~(R r) -> unary_bit_expression + { + return {std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_or.h b/include/sqlpp11/operator/bit_or.h new file mode 100644 index 00000000..2112d739 --- /dev/null +++ b/include/sqlpp11/operator/bit_or.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_or + { + static constexpr auto symbol = " | "; + }; + + template > + constexpr auto operator|(L l, R r) -> bit_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_shift_left.h b/include/sqlpp11/operator/bit_shift_left.h new file mode 100644 index 00000000..5cff1ad9 --- /dev/null +++ b/include/sqlpp11/operator/bit_shift_left.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_shift_left + { + static constexpr auto symbol = " << "; + }; + + template > + constexpr auto operator<<(L l, R r) -> bit_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_shift_right.h b/include/sqlpp11/operator/bit_shift_right.h new file mode 100644 index 00000000..5bc19bbb --- /dev/null +++ b/include/sqlpp11/operator/bit_shift_right.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_shift_right + { + static constexpr auto symbol = " >> "; + }; + + template > + constexpr auto operator>>(L l, R r) -> bit_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/bit_xor.h b/include/sqlpp11/operator/bit_xor.h new file mode 100644 index 00000000..cfcf0c51 --- /dev/null +++ b/include/sqlpp11/operator/bit_xor.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct bit_xor + { + static constexpr auto symbol = " ^ "; + }; + + template > + constexpr auto operator^(L l, R r) -> bit_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/desc.h b/include/sqlpp11/operator/desc.h new file mode 100644 index 00000000..b92f4ea2 --- /dev/null +++ b/include/sqlpp11/operator/desc.h @@ -0,0 +1,39 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + template > + constexpr auto desc(L l) -> sort_order_expression + { + return {l, sort_order::desc}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/divides.h b/include/sqlpp11/operator/divides.h new file mode 100644 index 00000000..a19fe50c --- /dev/null +++ b/include/sqlpp11/operator/divides.h @@ -0,0 +1,45 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include + +namespace sqlpp +{ + struct divides + { + static constexpr auto symbol = " / "; + }; + + template > + constexpr auto operator/(L l, R r) -> arithmetic_expression + { + return {std::move(l), std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/operator/equal_to.h b/include/sqlpp11/operator/equal_to.h new file mode 100644 index 00000000..02e29a90 --- /dev/null +++ b/include/sqlpp11/operator/equal_to.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct equal_to + { + static constexpr auto symbol = " = "; + }; + + template > + constexpr auto operator==(L l, R r) -> comparison_expression + { + return {l, r}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/exists.h b/include/sqlpp11/operator/exists.h new file mode 100644 index 00000000..dd055bff --- /dev/null +++ b/include/sqlpp11/operator/exists.h @@ -0,0 +1,68 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + template + struct exists_t + { + SubSelect sub_select; + }; + + template + using check_exists_arg = std::enable_if_t::value and has_result_row_t::value>; + +#warning: Document that functions dont come with their default alias any more + template > + constexpr auto exists(SubSelect sub_select) -> exists_t + { + return exists_t{sub_select}; + } + + /* + template + struct nodes_of> + { + using type = type_vector; + }; + + template + struct value_type_of_t> + { + using type = bool; + }; + + template + [[nodiscard]] auto to_sql_string(Context& context, const exists_t& t) + { + return " EXISTS(" + to_sql_string(context, t.sub_select) + ") "; + } + */ +} // namespace sqlpp diff --git a/include/sqlpp11/operator/greater.h b/include/sqlpp11/operator/greater.h new file mode 100644 index 00000000..e5f8281e --- /dev/null +++ b/include/sqlpp11/operator/greater.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct greater + { + static constexpr auto symbol = " > "; + }; + + template > + constexpr auto operator>(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/greater_equal.h b/include/sqlpp11/operator/greater_equal.h new file mode 100644 index 00000000..ee0c5a97 --- /dev/null +++ b/include/sqlpp11/operator/greater_equal.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct greater_equal + { + static constexpr auto symbol = " >= "; + }; + + template > + constexpr auto operator>=(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/in.h b/include/sqlpp11/operator/in.h new file mode 100644 index 00000000..c5cb8de9 --- /dev/null +++ b/include/sqlpp11/operator/in.h @@ -0,0 +1,60 @@ +#pragma once + +/* +Copyright (c) 2024, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include + +namespace sqlpp +{ + struct operator_in + { + static constexpr auto symbol = " IN "; + }; + +#warning: something.in(select(...)); should be suppported as is + template > + constexpr auto in(L l, std::tuple args) -> in_expression> + { + return {std::move(l), std::move(args)}; + } + + template > + constexpr auto in(L l, Args... args) -> in_expression> + { + return {std::move(l), std::make_tuple(std::move(args)...)}; + } + + template > + constexpr auto in(L l, std::vector args) -> in_expression> + { + return {std::move(l), std::move(args)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/is_distinct_from.h b/include/sqlpp11/operator/is_distinct_from.h new file mode 100644 index 00000000..f53d439a --- /dev/null +++ b/include/sqlpp11/operator/is_distinct_from.h @@ -0,0 +1,46 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct is_distinct_from + { + static constexpr auto symbol = " IS DISTINCT FROM "; // sql standard + // mysql has NULL-safe equal `<=>` which is equivalent to `IS NOT DISTINCT FROM` + // sqlite3 has `IS NOT` + }; + + template > + constexpr auto is_distinct_from(L l, R r) -> comparison_expression + { + return {l, r}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/is_not_distinct_from.h b/include/sqlpp11/operator/is_not_distinct_from.h new file mode 100644 index 00000000..0347a0c2 --- /dev/null +++ b/include/sqlpp11/operator/is_not_distinct_from.h @@ -0,0 +1,46 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct is_not_distinct_from + { + static constexpr auto symbol = " IS NOT DISTINCT FROM "; // sql standard + // mysql has NULL-safe equal `<=>` + // sqlite3 has `IS` + }; + + template > + constexpr auto is_not_distinct_from(L l, R r) -> comparison_expression + { + return {l, r}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/is_not_null.h b/include/sqlpp11/operator/is_not_null.h new file mode 100644 index 00000000..85f2f02a --- /dev/null +++ b/include/sqlpp11/operator/is_not_null.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct is_not + { + static constexpr auto symbol = " IS NOT "; + }; + + template + constexpr auto is_null(L l) -> comparison_expression + { + return {l}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/is_null.h b/include/sqlpp11/operator/is_null.h new file mode 100644 index 00000000..60f88769 --- /dev/null +++ b/include/sqlpp11/operator/is_null.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct is + { + static constexpr auto symbol = " IS "; + }; + + template + constexpr auto is_null(L l) -> comparison_expression + { + return {l}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/less.h b/include/sqlpp11/operator/less.h new file mode 100644 index 00000000..6b2fb94e --- /dev/null +++ b/include/sqlpp11/operator/less.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct less + { + static constexpr auto symbol = " < "; + }; + + template > + constexpr auto operator<(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/less_equal.h b/include/sqlpp11/operator/less_equal.h new file mode 100644 index 00000000..b2a22548 --- /dev/null +++ b/include/sqlpp11/operator/less_equal.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct less_equal + { + static constexpr auto symbol = " <= "; + }; + + template > + constexpr auto operator<=(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/like.h b/include/sqlpp11/operator/like.h new file mode 100644 index 00000000..cd465bbb --- /dev/null +++ b/include/sqlpp11/operator/like.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct operator_like + { + static constexpr auto symbol = " LIKE "; + }; + + template > + constexpr auto like(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/logical_and.h b/include/sqlpp11/operator/logical_and.h new file mode 100644 index 00000000..15c22c87 --- /dev/null +++ b/include/sqlpp11/operator/logical_and.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct logical_and + { + static constexpr auto symbol = " AND "; + }; + + template > + constexpr auto operator and(L l, R r) -> logical_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/logical_not.h b/include/sqlpp11/operator/logical_not.h new file mode 100644 index 00000000..ab7b4539 --- /dev/null +++ b/include/sqlpp11/operator/logical_not.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct logical_not + { + static constexpr auto symbol = "NOT "; + }; + + template > + constexpr auto operator!(R r) -> unary_logical_expression + { + return {std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/logical_or.h b/include/sqlpp11/operator/logical_or.h new file mode 100644 index 00000000..401e637c --- /dev/null +++ b/include/sqlpp11/operator/logical_or.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct logical_or + { + static constexpr auto symbol = " OR "; + }; + + template > + constexpr auto operator||(L l, R r) -> logical_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/minus.h b/include/sqlpp11/operator/minus.h new file mode 100644 index 00000000..e3538b38 --- /dev/null +++ b/include/sqlpp11/operator/minus.h @@ -0,0 +1,45 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include + +namespace sqlpp +{ + struct minus + { + static constexpr auto symbol = " - "; + }; + + template > + constexpr auto operator-(L l, R r) -> arithmetic_expression + { + return {std::move(l), std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/operator/modulus.h b/include/sqlpp11/operator/modulus.h new file mode 100644 index 00000000..872ff242 --- /dev/null +++ b/include/sqlpp11/operator/modulus.h @@ -0,0 +1,49 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include +#include + +namespace sqlpp +{ + struct modulus + { + static constexpr auto symbol = " % "; + }; + + template + using check_modulus_args = std::enable_if_t::value and has_integral_value::value>; + + template > + constexpr auto operator%(L l, R r) -> arithmetic_expression + { + return {std::move(l), std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/operator/multiplies.h b/include/sqlpp11/operator/multiplies.h new file mode 100644 index 00000000..c021280b --- /dev/null +++ b/include/sqlpp11/operator/multiplies.h @@ -0,0 +1,45 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include + +namespace sqlpp +{ + struct multiplies + { + static constexpr auto symbol = " * "; + }; + + template > + constexpr auto operator*(L l, R r) -> arithmetic_expression + { + return {std::move(l), std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/operator/negate.h b/include/sqlpp11/operator/negate.h new file mode 100644 index 00000000..9ce16d0d --- /dev/null +++ b/include/sqlpp11/operator/negate.h @@ -0,0 +1,45 @@ +#pragma once + +/* +Copyright (c) 2017, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include + +namespace sqlpp +{ + struct negate + { + static constexpr auto symbol = "-"; + }; + + template > + constexpr auto operator-(R r) -> unary_arithmetic_expression + { + return {std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/operator/not_equal_to.h b/include/sqlpp11/operator/not_equal_to.h new file mode 100644 index 00000000..cfed7b05 --- /dev/null +++ b/include/sqlpp11/operator/not_equal_to.h @@ -0,0 +1,44 @@ +#pragma once + +/* +Copyright (c) 2017- 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + struct not_equal_to + { + static constexpr auto symbol = " != "; + }; + + template > + constexpr auto operator!=(L l, R r) -> comparison_expression + { + return {std::move(l), std::move(r)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/not_in.h b/include/sqlpp11/operator/not_in.h new file mode 100644 index 00000000..a789d1d0 --- /dev/null +++ b/include/sqlpp11/operator/not_in.h @@ -0,0 +1,60 @@ +#pragma once + +/* +Copyright (c) 2024, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include + +namespace sqlpp +{ + struct operator_not_in + { + static constexpr auto symbol = " NOT IN "; + }; + +#warning: something.in(select(...)); should be suppported as is + template > + constexpr auto not_in(L l, std::tuple args) -> in_expression> + { + return {std::move(l), std::move(args)}; + } + + template > + constexpr auto not_in(L l, Args... args) -> in_expression> + { + return {std::move(l), std::make_tuple(std::move(args)...)}; + } + + template > + constexpr auto not_in(L l, std::vector args) -> in_expression> + { + return {std::move(l), std::move(args)}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/order.h b/include/sqlpp11/operator/order.h new file mode 100644 index 00000000..0e8ba905 --- /dev/null +++ b/include/sqlpp11/operator/order.h @@ -0,0 +1,39 @@ +#pragma once + +/* +Copyright (c) 2024, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +namespace sqlpp +{ + template > + constexpr auto order(L l, sort_order order) -> sort_order_expression + { + return {l, order}; + } + +} // namespace sqlpp diff --git a/include/sqlpp11/operator/plus.h b/include/sqlpp11/operator/plus.h new file mode 100644 index 00000000..d5956acf --- /dev/null +++ b/include/sqlpp11/operator/plus.h @@ -0,0 +1,45 @@ +#pragma once + +/* +Copyright (c) 2016 - 2018, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include + +namespace sqlpp +{ + struct plus + { + static constexpr auto symbol = " + "; + }; + + template > + constexpr auto operator+(L l, R r) -> arithmetic_expression + { + return {std::move(l), std::move(r)}; + } +} // namespace sqlpp diff --git a/include/sqlpp11/parameter.h b/include/sqlpp11/parameter.h index 20f27a96..00b16408 100644 --- a/include/sqlpp11/parameter.h +++ b/include/sqlpp11/parameter.h @@ -64,7 +64,7 @@ namespace sqlpp } template - auto parameter(const NamedExpr & /*unused*/) -> parameter_t, NamedExpr> + auto parameter(const NamedExpr & /*unused*/) -> parameter_t, NamedExpr> { static_assert(is_selectable_t::value, "not a named expression"); return {}; diff --git a/include/sqlpp11/postgresql/returning_column_list.h b/include/sqlpp11/postgresql/returning_column_list.h index 11699599..f0d8bcf5 100644 --- a/include/sqlpp11/postgresql/returning_column_list.h +++ b/include/sqlpp11/postgresql/returning_column_list.h @@ -60,7 +60,7 @@ namespace sqlpp template struct returning_traits { - using _traits = make_traits, + using _traits = make_traits, tag::is_returning_column_list, tag::is_return_value, tag::is_expression, diff --git a/include/sqlpp11/schema_qualified_table.h b/include/sqlpp11/schema_qualified_table.h index a8de5f12..ef95778c 100644 --- a/include/sqlpp11/schema_qualified_table.h +++ b/include/sqlpp11/schema_qualified_table.h @@ -40,7 +40,7 @@ namespace sqlpp template struct schema_qualified_table_t { - using _traits = make_traits, tag::is_table>; + using _traits = make_traits, tag::is_table>; using _nodes = detail::type_vector<>; using _required_ctes = detail::type_set<>; diff --git a/include/sqlpp11/select_column_list.h b/include/sqlpp11/select_column_list.h index bce56ad7..a86b493f 100644 --- a/include/sqlpp11/select_column_list.h +++ b/include/sqlpp11/select_column_list.h @@ -55,7 +55,7 @@ namespace sqlpp template struct select_traits { - using _traits = make_traits>, + using _traits = make_traits>, tag::is_select_column_list, tag::is_return_value, tag::is_expression, diff --git a/include/sqlpp11/select_pseudo_table.h b/include/sqlpp11/select_pseudo_table.h index 39c1c474..a2e55658 100644 --- a/include/sqlpp11/select_pseudo_table.h +++ b/include/sqlpp11/select_pseudo_table.h @@ -44,9 +44,8 @@ namespace sqlpp detail::make_intersect_set_t, typename Select::_used_outer_tables>::size::value > 0; - using _traits = make_traits, - tag::must_not_insert, - tag::must_not_update, +#warning: somehow prevent insert... + using _traits = make_traits, tag_if>; }; @@ -59,7 +58,7 @@ namespace sqlpp template struct select_expression_type { - using value_t = value_type_of; + using value_t = value_type_of_t; static constexpr bool _is_expression = true; static constexpr bool _can_be_null = can_be_null_t::value; }; diff --git a/include/sqlpp11/some.h b/include/sqlpp11/some.h index 1024f086..b1ab78bc 100644 --- a/include/sqlpp11/some.h +++ b/include/sqlpp11/some.h @@ -35,7 +35,7 @@ namespace sqlpp template struct some_t { - using _traits = make_traits, tag::is_multi_expression>; + using _traits = make_traits, tag::is_multi_expression>; using _nodes = detail::type_vector