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

Move clauses into sub directory

This commit is contained in:
Roland Bock 2024-07-28 19:37:39 +02:00
parent 6a92f139b7
commit df8e2b6c81
87 changed files with 136 additions and 684 deletions

View File

@ -26,10 +26,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace sqlpp #include <sqlpp11/aggregate_function/count.h>
{ #include <sqlpp11/aggregate_function/min.h>
template <typename Operand, typename... Args> #include <sqlpp11/aggregate_function/max.h>
struct in_t; #include <sqlpp11/aggregate_function/avg.h>
template <typename Operand, typename... Args> #include <sqlpp11/aggregate_function/sum.h>
struct not_in_t;
} // namespace sqlpp

View File

@ -28,7 +28,7 @@
#include <sqlpp11/enable_as.h> #include <sqlpp11/enable_as.h>
#include <sqlpp11/enable_over.h> #include <sqlpp11/enable_over.h>
#include <sqlpp11/select_flags.h> #include <sqlpp11/clause/select_flags.h>
#include <sqlpp11/aggregate_function_operators.h> #include <sqlpp11/aggregate_function_operators.h>
#include <sqlpp11/type_traits.h> #include <sqlpp11/type_traits.h>

View File

@ -1,33 +0,0 @@
#pragma once
/*
* Copyright (c) 2013-2015, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/aggregate_functions/count.h>
#include <sqlpp11/aggregate_functions/min.h>
#include <sqlpp11/aggregate_functions/max.h>
#include <sqlpp11/aggregate_functions/avg.h>
#include <sqlpp11/aggregate_functions/sum.h>

View File

@ -33,8 +33,8 @@
#include <sqlpp11/prepared_insert.h> #include <sqlpp11/prepared_insert.h>
#include <sqlpp11/default_value.h> #include <sqlpp11/default_value.h>
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/into.h> #include <sqlpp11/clause/into.h>
#include <sqlpp11/insert_value_list.h> #include <sqlpp11/clause/insert_value_list.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -28,7 +28,7 @@
#include <sqlpp11/operator/assign_expression.h> #include <sqlpp11/operator/assign_expression.h>
#include <sqlpp11/column_fwd.h> #include <sqlpp11/column_fwd.h>
#include <sqlpp11/insert_value.h> #include <sqlpp11/clause/insert_value.h>
#include <sqlpp11/interpret_tuple.h> #include <sqlpp11/interpret_tuple.h>
#include <sqlpp11/logic.h> #include <sqlpp11/logic.h>
#include <sqlpp11/no_data.h> #include <sqlpp11/no_data.h>

View File

@ -32,9 +32,9 @@
#include <sqlpp11/parameter_list.h> #include <sqlpp11/parameter_list.h>
#include <sqlpp11/prepared_remove.h> #include <sqlpp11/prepared_remove.h>
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/from.h> #include <sqlpp11/clause/from.h>
#include <sqlpp11/using.h> #include <sqlpp11/clause/using.h>
#include <sqlpp11/where.h> #include <sqlpp11/clause/where.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -30,18 +30,18 @@
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>
#include <sqlpp11/with.h> #include <sqlpp11/clause/with.h>
#include <sqlpp11/select_flag_list.h> #include <sqlpp11/clause/select_flag_list.h>
#include <sqlpp11/select_column_list.h> #include <sqlpp11/clause/select_column_list.h>
#include <sqlpp11/from.h> #include <sqlpp11/clause/from.h>
#include <sqlpp11/where.h> #include <sqlpp11/clause/where.h>
#include <sqlpp11/group_by.h> #include <sqlpp11/clause/group_by.h>
#include <sqlpp11/having.h> #include <sqlpp11/clause/having.h>
#include <sqlpp11/order_by.h> #include <sqlpp11/clause/order_by.h>
#include <sqlpp11/limit.h> #include <sqlpp11/clause/limit.h>
#include <sqlpp11/for_update.h> #include <sqlpp11/clause/for_update.h>
#include <sqlpp11/offset.h> #include <sqlpp11/clause/offset.h>
#include <sqlpp11/union.h> #include <sqlpp11/clause/union.h>
#include <sqlpp11/wrong.h> #include <sqlpp11/wrong.h>
namespace sqlpp namespace sqlpp

View File

@ -33,8 +33,8 @@
#include <sqlpp11/interpret_tuple.h> #include <sqlpp11/interpret_tuple.h>
#include <sqlpp11/policy_update.h> #include <sqlpp11/policy_update.h>
#include <sqlpp11/result_row.h> #include <sqlpp11/result_row.h>
#include <sqlpp11/select_as.h> #include <sqlpp11/clause/select_as.h>
#include <sqlpp11/select_column_traits.h> #include <sqlpp11/clause/select_column_traits.h>
#include <sqlpp11/table.h> #include <sqlpp11/table.h>
#include <tuple> #include <tuple>

View File

@ -30,7 +30,7 @@
#include <sqlpp11/interpret_tuple.h> #include <sqlpp11/interpret_tuple.h>
#include <sqlpp11/no_data.h> #include <sqlpp11/no_data.h>
#include <sqlpp11/policy_update.h> #include <sqlpp11/policy_update.h>
#include <sqlpp11/select_flags.h> #include <sqlpp11/clause/select_flags.h>
#include <sqlpp11/type_traits.h> #include <sqlpp11/type_traits.h>
#include <tuple> #include <tuple>

View File

@ -32,9 +32,9 @@
#include <sqlpp11/parameter_list.h> #include <sqlpp11/parameter_list.h>
#include <sqlpp11/prepared_update.h> #include <sqlpp11/prepared_update.h>
#include <sqlpp11/single_table.h> #include <sqlpp11/single_table.h>
#include <sqlpp11/update_list.h> #include <sqlpp11/clause/update_list.h>
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/where.h> #include <sqlpp11/clause/where.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -30,7 +30,7 @@
#include <sqlpp11/logic.h> #include <sqlpp11/logic.h>
#include <sqlpp11/parameter_list.h> #include <sqlpp11/parameter_list.h>
#include <sqlpp11/result_row.h> #include <sqlpp11/result_row.h>
#include <sqlpp11/select_flags.h> #include <sqlpp11/clause/select_flags.h>
#include <sqlpp11/statement_fwd.h> #include <sqlpp11/statement_fwd.h>
#include <sqlpp11/table_ref.h> #include <sqlpp11/table_ref.h>
#include <sqlpp11/type_traits.h> #include <sqlpp11/type_traits.h>
@ -169,10 +169,10 @@ namespace sqlpp
{ {
static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement"); static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement");
static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select"); static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select");
static_assert(has_result_row_t<Rhs>::value, "argument of a union has to be a (complete) select statement"); static_assert(has_result_row_t<Rhs>::value, "argument of a clause/union.has to be a (complete) select statement");
static_assert(std::is_same<_result_row_t, get_result_row_t<Rhs>>::value, static_assert(std::is_same<_result_row_t, get_result_row_t<Rhs>>::value,
"both select statements in a union have to have the same result columns (type and name)"); "both select statements in a clause/union.have to have the same result columns (type and name)");
return _union_impl<void, distinct_t>(check_cte_union_t<Rhs>{}, rhs); return _union_impl<void, distinct_t>(check_cte_union_t<Rhs>{}, rhs);
} }
@ -184,10 +184,10 @@ namespace sqlpp
{ {
static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement"); static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement");
static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select"); static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select");
static_assert(has_result_row_t<Rhs>::value, "argument of a union has to be a (complete) select statement"); static_assert(has_result_row_t<Rhs>::value, "argument of a clause/union.has to be a (complete) select statement");
static_assert(std::is_same<_result_row_t, get_result_row_t<Rhs>>::value, static_assert(std::is_same<_result_row_t, get_result_row_t<Rhs>>::value,
"both select statements in a union have to have the same result columns (type and name)"); "both select statements in a clause/union.have to have the same result columns (type and name)");
return _union_impl<all_t>(check_cte_union_t<Rhs>{}, rhs); return _union_impl<all_t>(check_cte_union_t<Rhs>{}, rhs);
} }

View File

@ -29,7 +29,7 @@
#include <type_traits> #include <type_traits>
#include <sqlpp11/type_traits.h> #include <sqlpp11/type_traits.h>
#include <sqlpp11/select_column_traits.h> #include <sqlpp11/clause/select_column_traits.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -30,11 +30,11 @@
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/parameter.h> #include <sqlpp11/parameter.h>
#include <sqlpp11/parameter_list.h> #include <sqlpp11/parameter_list.h>
#include <sqlpp11/aggregate_functions.h> #include <sqlpp11/aggregate_function.h>
#include <sqlpp11/trim.h> #include <sqlpp11/function/trim.h>
#include <sqlpp11/case.h> #include <sqlpp11/case.h>
#include <sqlpp11/lower.h> #include <sqlpp11/function/lower.h>
#include <sqlpp11/upper.h> #include <sqlpp11/function/upper.h>
#include <sqlpp11/value_type.h> #include <sqlpp11/value_type.h>
#include <sqlpp11/verbatim.h> // Csaba Csoma suggests: unsafe_sql instead of verbatim #include <sqlpp11/verbatim.h> // Csaba Csoma suggests: unsafe_sql instead of verbatim
#include <sqlpp11/parameterized_verbatim.h> #include <sqlpp11/parameterized_verbatim.h>

View File

@ -1,35 +0,0 @@
#pragma once
/*
* Copyright (c) 2013-2015, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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.
*/
namespace sqlpp
{
template <typename Operand>
struct is_null_t;
template <typename Operand>
struct is_not_null_t;
} // namespace sqlpp

View File

@ -1,72 +0,0 @@
#pragma once
/*
* Copyright (c) 2023, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/serialize.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp
{
template <typename Expr>
struct lower_t
{
using _traits = make_traits<text, tag::is_expression, tag::is_selectable>;
using _nodes = detail::type_vector<Expr>;
lower_t(const Expr expr) : _expr(expr)
{
}
lower_t(const lower_t&) = default;
lower_t(lower_t&&) = default;
lower_t& operator=(const lower_t&) = default;
lower_t& operator=(lower_t&&) = default;
~lower_t() = default;
Expr _expr;
};
template <typename Context, typename Expr>
Context& serialize(Context& context, const lower_t<Expr>& t)
{
context << "LOWER(";
serialize_operand(context, t._expr);
context << ")";
return context;
}
template<typename T>
using check_lower_args = std::enable_if_t<is_text<T>::value>;
template <typename T, typename = check_lower_args<T>>
auto lower(T t) -> lower_t<T>
{
return {std::move(t)};
}
} // namespace sqlpp

View File

@ -55,7 +55,7 @@ namespace sqlpp
bind_result_t(const std::shared_ptr<detail::prepared_statement_handle_t>& handle) : _handle{handle} bind_result_t(const std::shared_ptr<detail::prepared_statement_handle_t>& handle) : _handle{handle}
{ {
if (_handle and _handle->debug) if (_handle and _handle->debug)
std::cerr << "MySQL debug: Constructing bind result, using handle at " << _handle.get() << std::endl; std::cerr << "MySQL debug: Constructing bind result, clause/using.handle at " << _handle.get() << std::endl;
} }
bind_result_t(const bind_result_t&) = delete; bind_result_t(const bind_result_t&) = delete;
bind_result_t(bind_result_t&& rhs) = default; bind_result_t(bind_result_t&& rhs) = default;

View File

@ -57,7 +57,7 @@ namespace sqlpp
throw sqlpp::exception{"MySQL: Constructing char_result without valid handle"}; throw sqlpp::exception{"MySQL: Constructing char_result without valid handle"};
if (_handle->debug) if (_handle->debug)
std::cerr << "MySQL debug: Constructing result, using handle at " << _handle.get() << std::endl; std::cerr << "MySQL debug: Constructing result, clause/using.handle at " << _handle.get() << std::endl;
} }
char_result_t(const char_result_t&) = delete; char_result_t(const char_result_t&) = delete;

View File

@ -35,8 +35,8 @@
#include <sqlpp11/mysql/connection_config.h> #include <sqlpp11/mysql/connection_config.h>
#include <sqlpp11/mysql/detail/connection_handle.h> #include <sqlpp11/mysql/detail/connection_handle.h>
#include <sqlpp11/mysql/prepared_statement.h> #include <sqlpp11/mysql/prepared_statement.h>
#include <sqlpp11/mysql/remove.h> #include <sqlpp11/mysql/clause/remove.h>
#include <sqlpp11/mysql/update.h> #include <sqlpp11/mysql/clause/update.h>
#include <sqlpp11/serialize.h> #include <sqlpp11/serialize.h>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>

View File

@ -51,7 +51,7 @@ namespace sqlpp
prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle) : _handle{std::move(handle)} prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle) : _handle{std::move(handle)}
{ {
if (_handle and _handle->debug) if (_handle and _handle->debug)
std::cerr << "MySQL debug: Constructing prepared_statement, using handle at " << _handle.get() << std::endl; std::cerr << "MySQL debug: Constructing prepared_statement, clause/using.handle at " << _handle.get() << std::endl;
} }
prepared_statement_t(const prepared_statement_t&) = delete; prepared_statement_t(const prepared_statement_t&) = delete;

View File

@ -26,9 +26,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/order_by.h> #include <sqlpp11/clause/order_by.h>
#include <sqlpp11/limit.h> #include <sqlpp11/clause/clause/limit.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -27,7 +27,7 @@
*/ */
#include <sqlpp11/data_types/text/concat.h> #include <sqlpp11/data_types/text/concat.h>
#include <sqlpp11/insert_value_list.h> #include <sqlpp11/clause/insert_value_list.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -26,9 +26,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <sqlpp11/limit.h> #include <sqlpp11/clause/clause/limit.h>
#include <sqlpp11/order_by.h> #include <sqlpp11/clause/order_by.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -69,7 +69,7 @@ namespace sqlpp
{ {
serialize_operand(context, t._expression); serialize_operand(context, t._expression);
context << " AS "; context << " AS ";
context << name_tag_of_t<as_expression<Expression, AliasProvider>>::_name_t::template char_ptr<Context>(); context << name_tag_of_t<AliasProvider>::_name_t::template char_ptr<Context>();
return context; return context;
} }
template <typename Expr, typename AliasProvider> template <typename Expr, typename AliasProvider>

View File

@ -155,7 +155,7 @@ namespace sqlpp
_var_buffers.resize(_handle->result.field_count()); _var_buffers.resize(_handle->result.field_count());
if (this->_handle && this->_handle->debug()) if (this->_handle && this->_handle->debug())
{ {
std::cerr << "PostgreSQL debug: constructing bind result, using handle at: " << this->_handle.get() std::cerr << "PostgreSQL debug: constructing bind result, clause/using.handle at: " << this->_handle.get()
<< std::endl; << std::endl;
} }
} }

View File

@ -28,7 +28,7 @@
*/ */
/** /**
classes copied from http://pqxx.org/devprojects/libpqxx/doc/3.1/html/Reference/a00032.html classes copied clause/from.http://pqxx.org/devprojects/libpqxx/doc/3.1/html/Reference/a00032.html
*/ */
#include "visibility.h" #include "visibility.h"

View File

@ -26,7 +26,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/postgresql/on_conflict.h> #include <sqlpp11/postgresql/on_conflict.h>
#include <sqlpp11/postgresql/returning.h> #include <sqlpp11/postgresql/returning.h>

View File

@ -28,7 +28,7 @@
*/ */
#include <sqlpp11/postgresql/on_conflict_do_nothing.h> #include <sqlpp11/postgresql/on_conflict_do_nothing.h>
#include <sqlpp11/postgresql/on_conflict_do_update.h> #include <sqlpp11/postgresql/on_conflict_do_clause/update.h>
#include <sqlpp11/statement.h> #include <sqlpp11/statement.h>
namespace sqlpp namespace sqlpp

View File

@ -30,7 +30,7 @@
#include <sqlpp11/detail/type_set.h> #include <sqlpp11/detail/type_set.h>
#include <sqlpp11/interpret_tuple.h> #include <sqlpp11/interpret_tuple.h>
#include <sqlpp11/type_traits.h> #include <sqlpp11/type_traits.h>
#include <sqlpp11/where.h> #include <sqlpp11/clause/where.h>
namespace sqlpp namespace sqlpp
{ {

View File

@ -31,6 +31,6 @@
#include <sqlpp11/postgresql/connection.h> #include <sqlpp11/postgresql/connection.h>
#include <sqlpp11/postgresql/connection_pool.h> #include <sqlpp11/postgresql/connection_pool.h>
#include <sqlpp11/postgresql/exception.h> #include <sqlpp11/postgresql/exception.h>
#include <sqlpp11/postgresql/insert.h> #include <sqlpp11/postgresql/clause/insert.h>
#include <sqlpp11/postgresql/remove.h> #include <sqlpp11/postgresql/clause/remove.h>
#include <sqlpp11/postgresql/update.h> #include <sqlpp11/postgresql/clause/update.h>

View File

@ -67,7 +67,7 @@ namespace sqlpp
{ {
if (_handle && _handle->debug()) if (_handle && _handle->debug())
{ {
std::cerr << "PostgreSQL debug: constructing prepared_statement, using handle at: " << _handle.get() std::cerr << "PostgreSQL debug: constructing prepared_statement, clause/using.handle at: " << _handle.get()
<< std::endl; << std::endl;
} }
} }

View File

@ -26,7 +26,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/postgresql/returning.h> #include <sqlpp11/postgresql/returning.h>
namespace sqlpp namespace sqlpp

View File

@ -28,7 +28,7 @@
*/ */
#include <sqlpp11/postgresql/returning_column_list.h> #include <sqlpp11/postgresql/returning_column_list.h>
#include <sqlpp11/select_column_list.h> #include <sqlpp11/clause/select_column_list.h>
#include <sqlpp11/statement.h> #include <sqlpp11/statement.h>
namespace sqlpp namespace sqlpp

View File

@ -26,7 +26,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <sqlpp11/postgresql/returning.h> #include <sqlpp11/postgresql/returning.h>
namespace sqlpp namespace sqlpp

View File

@ -57,7 +57,7 @@ namespace sqlpp
bind_result_t(const std::shared_ptr<detail::prepared_statement_handle_t>& handle) : _handle{handle} bind_result_t(const std::shared_ptr<detail::prepared_statement_handle_t>& handle) : _handle{handle}
{ {
if (_handle and _handle->debug) if (_handle and _handle->debug)
std::cerr << "Sqlite3 debug: Constructing bind result, using handle at " << _handle.get() << std::endl; std::cerr << "Sqlite3 debug: Constructing bind result, clause/using.handle at " << _handle.get() << std::endl;
} }
bind_result_t(const bind_result_t&) = delete; bind_result_t(const bind_result_t&) = delete;

View File

@ -27,8 +27,8 @@
*/ */
#include <sqlpp11/default_value.h> #include <sqlpp11/default_value.h>
#include <sqlpp11/insert_value_list.h> #include <sqlpp11/clause/insert_value_list.h>
#include <sqlpp11/into.h> #include <sqlpp11/clause/into.h>
#include <sqlpp11/noop.h> #include <sqlpp11/noop.h>
#include <sqlpp11/parameter_list.h> #include <sqlpp11/parameter_list.h>
#include <sqlpp11/prepared_insert.h> #include <sqlpp11/prepared_insert.h>

View File

@ -82,7 +82,7 @@ namespace sqlpp
prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle) : _handle(std::move(handle)) prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle) : _handle(std::move(handle))
{ {
if (_handle and _handle->debug) if (_handle and _handle->debug)
std::cerr << "Sqlite3 debug: Constructing prepared_statement, using handle at " << _handle.get() << std::endl; std::cerr << "Sqlite3 debug: Constructing prepared_statement, clause/using.handle at " << _handle.get() << std::endl;
} }
prepared_statement_t(const prepared_statement_t&) = delete; prepared_statement_t(const prepared_statement_t&) = delete;
prepared_statement_t(prepared_statement_t&& rhs) = default; prepared_statement_t(prepared_statement_t&& rhs) = default;

View File

@ -40,7 +40,7 @@
#include <sqlpp11/parameter.h> #include <sqlpp11/parameter.h>
#include <sqlpp11/pre_join.h> #include <sqlpp11/pre_join.h>
#include <sqlpp11/some.h> #include <sqlpp11/some.h>
#include <sqlpp11/with.h> #include <sqlpp11/clause/with.h>
#include <cmath> #include <cmath>

View File

@ -27,13 +27,12 @@
*/ */
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/functions.h> #include <sqlpp11/function.h>
#include <sqlpp11/operator.h> #include <sqlpp11/operator.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/without_table_check.h>
#include <sqlpp11/schema_qualified_table.h> #include <sqlpp11/schema_qualified_table.h>
#include <sqlpp11/custom_query.h> #include <sqlpp11/custom_query.h>

View File

@ -1,80 +0,0 @@
#pragma once
/*
* Copyright (c) 2013-2015, Roland Bock
* Copyright (c) 2017, Juan Dent
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/serialize.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp
{
template <typename Expr>
struct trim_t
{
using _traits = make_traits<text, tag::is_expression, tag::is_selectable>;
trim_t(const Expr expr) : _expr(expr)
{
}
trim_t(const trim_t&) = default;
trim_t(trim_t&&) = default;
trim_t& operator=(const trim_t&) = default;
trim_t& operator=(trim_t&&) = default;
~trim_t() = default;
Expr _expr;
};
template<typename Expr>
struct value_type_of<trim_t<Expr>> : public value_type_of<Expr> {};
template<typename Expr>
struct nodes_of<trim_t<Expr>>
{
using type = detail::type_vector<Expr>;
};
template <typename Context, typename Expr>
Context& serialize(Context& context, const trim_t<Expr>& t)
{
context << "TRIM(";
serialize_operand(context, t._expr);
context << ")";
return context;
}
template<typename T>
using check_trim_args = std::enable_if_t<is_text<T>::value>;
template <typename T, typename = check_trim_args<T>>
auto trim(T t) -> trim_t<T>
{
return {std::move(t)};
}
} // namespace sqlpp

View File

@ -1,197 +0,0 @@
#pragma once
/*
* Copyright (c) 2013-2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/interpret_tuple.h>
#include <sqlpp11/logic.h>
#include <sqlpp11/parameter_list.h>
#include <sqlpp11/result_row.h>
#include <sqlpp11/statement_fwd.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/union_data.h>
#include <sqlpp11/union_flags.h>
namespace sqlpp
{
struct no_union_t;
using blank_union_t = statement_t<no_union_t>;
// There is no order by or limit or offset in union, use it as a pseudo table to do that.
template <typename Check, typename Union>
struct union_statement_impl
{
using type = Check;
};
template <typename Union>
struct union_statement_impl<consistent_t, Union>
{
using type = statement_t<Union, no_union_t>;
};
template <typename Check, typename Union>
using union_statement_t = typename union_statement_impl<Check, Union>::type;
// UNION(EXPR)
template <typename Flag, typename Lhs, typename Rhs>
struct union_t
{
using _traits = make_traits<no_value_t, tag::is_union, tag::is_return_value>;
using _nodes = detail::type_vector<Lhs, Rhs>;
using _data_t = union_data_t<Flag, Lhs, Rhs>;
// Base template to be inherited by the statement
template <typename Policies>
struct _base_t
{
_base_t(_data_t data) : _data{std::move(data)}
{
}
_data_t _data;
using _selected_columns_t = typename std::decay<decltype(_data._lhs.get_selected_columns())>::type;
_selected_columns_t& get_selected_columns()
{
return _data._lhs.get_selected_columns();
}
const _selected_columns_t& get_selected_columns() const
{
return _data._lhs.get_selected_columns();
}
using _consistency_check = detail::get_first_if<is_inconsistent_t,
consistent_t,
typename Lhs::_consistency_check,
typename Rhs::_consistency_check>;
};
template <typename Statement>
using _result_methods_t = typename Lhs::template _result_methods_t<Statement>;
};
SQLPP_PORTABLE_STATIC_ASSERT(assert_union_args_are_statements_t, "arguments for union() must be statements");
template <typename... T>
struct check_union
{
using type = static_combined_check_t<
static_check_t<logic::all_t<is_statement_t<T>::value...>::value, assert_union_args_are_statements_t>>;
};
template <typename... T>
using check_union_t = typename check_union<T...>::type;
// NO UNION YET
struct no_union_t
{
using _traits = make_traits<no_value_t, tag::is_union>;
using _nodes = detail::type_vector<>;
// Data
using _data_t = no_data_t;
template <typename Policies>
struct _base_t
{
_base_t() = default;
_base_t(_data_t data) : _data{std::move(data)}
{
}
_data_t _data;
template <typename Check, typename T>
using _new_statement_t = union_statement_t<Check, T>;
using _consistency_check = consistent_t;
template <typename Rhs>
auto union_distinct(Rhs rhs) const
-> _new_statement_t<check_union_t<derived_statement_t<Policies>, Rhs>,
union_t<union_distinct_t, derived_statement_t<Policies>, Rhs>>
{
static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement");
static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select");
static_assert(has_result_row_t<Rhs>::value, "argument of a union has to be a complete select statement");
static_assert(has_result_row_t<derived_statement_t<Policies>>::value,
"left hand side argument of a union has to be a complete select statement or union");
using lhs_result_row_t = get_result_row_t<derived_statement_t<Policies>>;
using rhs_result_row_t = get_result_row_t<Rhs>;
static_assert(is_result_compatible<lhs_result_row_t, rhs_result_row_t>::value,
"both arguments in a union have to have the same result columns (type and name)");
return _union_impl<union_distinct_t>(check_union_t<derived_statement_t<Policies>, Rhs>{}, rhs);
}
template <typename Rhs>
auto union_all(Rhs rhs) const -> _new_statement_t<check_union_t<derived_statement_t<Policies>, Rhs>,
union_t<union_all_t, derived_statement_t<Policies>, Rhs>>
{
static_assert(is_statement_t<Rhs>::value, "argument of union call has to be a statement");
static_assert(has_policy_t<Rhs, is_select_t>::value, "argument of union call has to be a select");
static_assert(has_result_row_t<Rhs>::value, "argument of a union has to be a (complete) select statement");
static_assert(has_result_row_t<derived_statement_t<Policies>>::value,
"left hand side argument of a union has to be a (complete) select statement");
using lhs_result_row_t = get_result_row_t<derived_statement_t<Policies>>;
using rhs_result_row_t = get_result_row_t<Rhs>;
static_assert(is_result_compatible<lhs_result_row_t, rhs_result_row_t>::value,
"both arguments in a union have to have the same result columns (type and name)");
return _union_impl<union_all_t>(check_union_t<derived_statement_t<Policies>, Rhs>{}, rhs);
}
private:
template <typename Flag, typename Check, typename Rhs>
auto _union_impl(Check, Rhs rhs) const -> inconsistent<Check>;
template <typename Flag, typename Rhs>
auto _union_impl(consistent_t /*unused*/, Rhs rhs) const
-> _new_statement_t<consistent_t, union_t<Flag, derived_statement_t<Policies>, Rhs>>
{
return {blank_union_t{}, union_data_t<Flag, derived_statement_t<Policies>, Rhs>{
static_cast<const derived_statement_t<Policies>&>(*this), rhs}};
}
};
};
/*
template <typename T>
auto union_all(T&& t) -> decltype(statement_t<no_union_t>().union_all(std::forward<T>(t)))
{
return statement_t<no_union_t>().union_all(std::forward<T>(t));
}
template <typename T>
auto union_distinct(T&& t) -> decltype(statement_t<no_union_t>().union_distinct(std::forward<T>(t)))
{
return statement_t<no_union_t>().union_distinct(std::forward<T>(t));
}
*/
} // namespace sqlpp

View File

@ -1,72 +0,0 @@
#pragma once
/*
* Copyright (c) 2023, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/serialize.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp
{
template <typename Expr>
struct upper_t
{
using _traits = make_traits<text, tag::is_expression, tag::is_selectable>;
using _nodes = detail::type_vector<Expr>;
upper_t(const Expr expr) : _expr(expr)
{
}
upper_t(const upper_t&) = default;
upper_t(upper_t&&) = default;
upper_t& operator=(const upper_t&) = default;
upper_t& operator=(upper_t&&) = default;
~upper_t() = default;
Expr _expr;
};
template <typename Context, typename Expr>
Context& serialize(Context& context, const upper_t<Expr>& t)
{
context << "UPPER(";
serialize_operand(context, t._expr);
context << ")";
return context;
}
template<typename T>
using check_upper_args = std::enable_if_t<is_text<T>::value>;
template <typename T, typename = check_upper_args<T>>
auto upper(T t) -> upper_t<T>
{
return {std::move(t)};
}
} // namespace sqlpp

View File

@ -1,60 +0,0 @@
#pragma once
/*
* Copyright (c) 2016-2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 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 <sqlpp11/type_traits.h>
namespace sqlpp
{
template <typename Expression>
struct without_table_check_t: public Expression
{
using _required_tables = detail::type_set<>;
without_table_check_t(Expression expression) : Expression(expression)
{
}
const Expression& expr() const { return *this; }
};
template <typename Context, typename Expression>
Context& serialize(Context& context, const without_table_check_t<Expression>& t)
{
serialize(context, t.expr());
return context;
}
template <typename Expression>
auto without_table_check(Expression expr) -> without_table_check_t<Expression>
{
static_assert(is_expression_t<Expression>::value or is_alias_t<Expression>::value,
"invalid argument (expression or alias expression expected)");
return {expr};
}
} // namespace sqlpp

View File

@ -30,7 +30,7 @@
#include "Sample.h" #include "Sample.h"
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <iostream> #include <iostream>
MockDb db; MockDb db;

View File

@ -30,7 +30,7 @@
#include "Sample.h" #include "Sample.h"
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
MockDb db; MockDb db;

View File

@ -30,7 +30,7 @@
#include "Sample.h" #include "Sample.h"
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <iostream> #include <iostream>
MockDb db; MockDb db;

View File

@ -29,7 +29,7 @@
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
namespace namespace
{ {

View File

@ -35,7 +35,7 @@ function(test_compile name)
endfunction() endfunction()
add_subdirectory(operator) add_subdirectory(operator)
test_compile(aggregate_functions) test_compile(aggregate_function)
test_compile(case_when) test_compile(case_when)
test_compile(dynamic) test_compile(dynamic)
test_compile(result_row) test_compile(result_row)

View File

@ -56,8 +56,8 @@ void test_dynamic(Value v)
static_assert(not sqlpp::has_name<decltype(v_not_null)>::value, ""); static_assert(not sqlpp::has_name<decltype(v_not_null)>::value, "");
static_assert(not sqlpp::has_name<decltype(v_maybe_null)>::value, ""); static_assert(not sqlpp::has_name<decltype(v_maybe_null)>::value, "");
static_assert(sqlpp::has_name<decltype(v_not_null_alias)>::value, ""); static_assert(not sqlpp::has_name<decltype(v_not_null_alias)>::value, "");
static_assert(sqlpp::has_name<decltype(v_maybe_null_alias)>::value, ""); static_assert(not sqlpp::has_name<decltype(v_maybe_null_alias)>::value, "");
static_assert(is_select_column_value_type<decltype(v_not_null), OptValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_not_null), OptValueType>::value, "");
static_assert(is_select_column_value_type<decltype(v_maybe_null), OptValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_maybe_null), OptValueType>::value, "");

View File

@ -76,8 +76,11 @@ void test_select_as(Value v)
static_assert(is_same_type<decltype(select(v_maybe_null).as(column).sometimes), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_maybe_null).as(column).sometimes), OptValueType>(), "");
// The column of a single-value pseudo table can be renamed and used as named value // The column of a single-value pseudo table can be renamed and used as named value
static_assert(sqlpp::has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, ""); static_assert(not sqlpp::has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, "");
static_assert(sqlpp::has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, ""); static_assert(not sqlpp::has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, "");
static_assert(is_select_column_same_type<decltype(select(v_not_null).as(column).always.as(foo)), ValueType>(), ""); static_assert(is_select_column_same_type<decltype(select(v_not_null).as(column).always.as(foo)), ValueType>(), "");
static_assert(is_select_column_same_type<decltype(select(v_maybe_null).as(column).sometimes.as(foo)), OptValueType>(), ""); static_assert(is_select_column_same_type<decltype(select(v_maybe_null).as(column).sometimes.as(foo)), OptValueType>(), "");
@ -102,8 +105,11 @@ void test_select_as(Value v)
static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes), OptValueType>(), "");
// The column of a multi-value pseudo table can be renamed and used as named value // The column of a multi-value pseudo table can be renamed and used as named value
static_assert(sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, ""); static_assert(not sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, "");
static_assert(sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, ""); static_assert(not sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, "");
static_assert(is_select_column_same_type<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo)), ValueType>(), ""); static_assert(is_select_column_same_type<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo)), ValueType>(), "");
static_assert(is_select_column_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo)), OptValueType>(), ""); static_assert(is_select_column_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo)), OptValueType>(), "");

View File

@ -27,7 +27,7 @@
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/auto_alias.h> #include <sqlpp11/auto_alias.h>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>

View File

@ -29,8 +29,8 @@
#include <iostream> #include <iostream>
#include <sqlpp11/compat/string_view.h> #include <sqlpp11/compat/string_view.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
int Insert(int, char*[]) int Insert(int, char*[])
{ {

View File

@ -27,7 +27,7 @@
#include "MockDb.h" #include "MockDb.h"
#include "is_regular.h" #include "is_regular.h"
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"
int Prepared(int, char* []) int Prepared(int, char* [])

View File

@ -31,8 +31,7 @@
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/without_table_check.h>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"
struct to_cerr struct to_cerr

View File

@ -29,8 +29,7 @@
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/without_table_check.h>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"
namespace alias namespace alias

View File

@ -25,7 +25,7 @@
#include "Sample.h" #include "Sample.h"
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <iostream> #include <iostream>

View File

@ -25,7 +25,7 @@
#include "Sample.h" #include "Sample.h"
#include "MockDb.h" #include "MockDb.h"
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <iostream> #include <iostream>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"

View File

@ -60,7 +60,7 @@ namespace sqlpp
} }
for (;;) { for (;;) {
auto handle = pool.get().native_handle(); auto handle = pool.get().native_handle();
auto insert_res = ns.insert(handle); auto insert_res = ns.clause/insert.handle);
if (insert_res.second == false) { if (insert_res.second == false) {
return ns; return ns;
} }

View File

@ -27,12 +27,12 @@
#include "Tables.h" #include "Tables.h"
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/mysql/connection.h> #include <sqlpp11/mysql/connection.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>

View File

@ -27,12 +27,12 @@
#include "Tables.h" #include "Tables.h"
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/mysql/connection.h> #include <sqlpp11/mysql/connection.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>

View File

@ -28,12 +28,12 @@
#include <cassert> #include <cassert>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/mysql/connection.h> #include <sqlpp11/mysql/connection.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>

View File

@ -28,12 +28,12 @@
#include <cassert> #include <cassert>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/mysql/connection.h> #include <sqlpp11/mysql/connection.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"
#include <iostream> #include <iostream>

View File

@ -28,12 +28,12 @@
#include <cassert> #include <cassert>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/mysql/connection.h> #include <sqlpp11/mysql/connection.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include "../../include/test_helpers.h" #include "../../include/test_helpers.h"
#include <iostream> #include <iostream>

View File

@ -26,12 +26,12 @@
#include "TabSample.h" #include "TabSample.h"
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/sqlite3/connection.h> #include <sqlpp11/sqlite3/connection.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#ifdef SQLPP_USE_SQLCIPHER #ifdef SQLPP_USE_SQLCIPHER
#include <sqlcipher/sqlite3.h> #include <sqlcipher/sqlite3.h>

View File

@ -26,12 +26,12 @@
#include "Tables.h" #include "Tables.h"
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/sqlite3/connection.h> #include <sqlpp11/sqlite3/connection.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#ifdef SQLPP_USE_SQLCIPHER #ifdef SQLPP_USE_SQLCIPHER
#include <sqlcipher/sqlite3.h> #include <sqlcipher/sqlite3.h>

View File

@ -28,12 +28,12 @@
#include <cassert> #include <cassert>
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/sqlite3/connection.h> #include <sqlpp11/sqlite3/connection.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>

View File

@ -27,12 +27,12 @@
#include <sqlpp11/alias_provider.h> #include <sqlpp11/alias_provider.h>
#include <sqlpp11/custom_query.h> #include <sqlpp11/custom_query.h>
#include <sqlpp11/functions.h> #include <sqlpp11/functions.h>
#include <sqlpp11/insert.h> #include <sqlpp11/clause/insert.h>
#include <sqlpp11/remove.h> #include <sqlpp11/clause/remove.h>
#include <sqlpp11/select.h> #include <sqlpp11/clause/select.h>
#include <sqlpp11/sqlite3/connection.h> #include <sqlpp11/sqlite3/connection.h>
#include <sqlpp11/transaction.h> #include <sqlpp11/transaction.h>
#include <sqlpp11/update.h> #include <sqlpp11/clause/update.h>
#ifdef SQLPP_USE_SQLCIPHER #ifdef SQLPP_USE_SQLCIPHER
#include <sqlcipher/sqlite3.h> #include <sqlcipher/sqlite3.h>