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

Revert "Modify select.h to support connection_pool and pool_connection"

This reverts commit ecd6a6aeb8.
This commit is contained in:
Frank Park 2017-04-11 01:28:04 -04:00
parent ecd6a6aeb8
commit c6c075b0ab

View File

@ -45,8 +45,6 @@
#include <sqlpp11/expression.h> #include <sqlpp11/expression.h>
#include <sqlpp11/wrong.h> #include <sqlpp11/wrong.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp namespace sqlpp
{ {
struct select_name_t struct select_name_t
@ -97,59 +95,18 @@ namespace sqlpp
return blank_select_t<void>().columns(columns...); return blank_select_t<void>().columns(columns...);
} }
template <typename... Args>
blank_select_t<void> dynamic_select(Args& ...)
{
static_assert(false, "Invalid database parameter");
return {};
}
template <template <typename, typename, typename, typename> typename Pool_connection,
typename Connection_config, typename Connection_validator, typename Connection, typename Connection_pool,
typename std::enable_if<std::is_class<Connection>::value, int>::type = 0>
blank_select_t<Connection> dynamic_select(const Pool_connection<Connection_config, Connection_validator, Connection, Connection_pool>&)
{
return {};
}
template <template <typename, typename, typename> typename Connection_pool,
typename Connection_config, typename Connection_validator, typename Connection,
typename std::enable_if<std::is_class<Connection>::value, int>::type = 0>
blank_select_t<Connection> dynamic_select(const Connection_pool<Connection_config, Connection_validator, Connection>&)
{
return {};
}
template <typename Database> template <typename Database>
blank_select_t<Database> dynamic_select(const Database&, typename std::enable_if<std::is_base_of<connection, Database>::value, int>::type = 0) blank_select_t<Database> dynamic_select(const Database&)
{ {
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
return {}; return {};
} }
template <template <typename, typename, typename, typename> typename Pool_connection, typename... Columns, template <typename Database, typename... Columns>
typename Connection_config, typename Connection_validator, typename Connection, typename Connection_pool, auto dynamic_select(const Database&, Columns... columns) -> decltype(blank_select_t<Database>().columns(columns...))
typename std::enable_if<std::is_class<Connection>::value, int>::type = 0>
auto dynamic_select(const Pool_connection<Connection_config, Connection_validator, Connection, Connection_pool>&, Columns... columns)
-> decltype(blank_select_t<Connection>().columns(columns...))
{ {
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
return blank_select_t<Database>().columns(columns...); return blank_select_t<Database>().columns(columns...);
} }
template <template <typename, typename, typename> typename Connection_pool, typename... Columns,
typename Connection_config, typename Connection_validator, typename Connection,
typename std::enable_if<std::is_class<Connection>::value, int>::type = 0>
auto dynamic_select(const Connection_pool<Connection_config, Connection_validator, Connection>&, Columns... columns)
-> decltype(blank_select_t<Connection>().columns(columns...))
{
return {};
}
template <typename Connection, typename... Columns>
auto dynamic_select(const Connection&, Columns... columns,
typename std::enable_if<std::is_base_of<connection, Connection>::value, int>::type = 0)
-> decltype(blank_select_t<Connection>().columns(columns...))
{
return {};
}
} }
#endif #endif