mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Added static assert to give clearer error message for dynamic_xy
This commit is contained in:
parent
a4721ff31e
commit
11950bc0c7
@ -28,6 +28,7 @@
|
|||||||
#define SQLPP_INSERT_H
|
#define SQLPP_INSERT_H
|
||||||
|
|
||||||
#include <sqlpp11/statement.h>
|
#include <sqlpp11/statement.h>
|
||||||
|
#include <sqlpp11/connection.h>
|
||||||
#include <sqlpp11/type_traits.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
#include <sqlpp11/parameter_list.h>
|
#include <sqlpp11/parameter_list.h>
|
||||||
#include <sqlpp11/prepared_insert.h>
|
#include <sqlpp11/prepared_insert.h>
|
||||||
@ -111,6 +112,7 @@ namespace sqlpp
|
|||||||
constexpr auto dynamic_insert(const Database&)
|
constexpr auto dynamic_insert(const Database&)
|
||||||
-> decltype(blank_insert_t<Database>())
|
-> decltype(blank_insert_t<Database>())
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { blank_insert_t<Database>() };
|
return { blank_insert_t<Database>() };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +120,7 @@ namespace sqlpp
|
|||||||
constexpr auto dynamic_insert_into(const Database&, Table table)
|
constexpr auto dynamic_insert_into(const Database&, Table table)
|
||||||
-> decltype(blank_insert_t<Database>().into(table))
|
-> decltype(blank_insert_t<Database>().into(table))
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { blank_insert_t<Database>().into(table) };
|
return { blank_insert_t<Database>().into(table) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define SQLPP_REMOVE_H
|
#define SQLPP_REMOVE_H
|
||||||
|
|
||||||
#include <sqlpp11/statement.h>
|
#include <sqlpp11/statement.h>
|
||||||
|
#include <sqlpp11/connection.h>
|
||||||
#include <sqlpp11/type_traits.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
#include <sqlpp11/parameter_list.h>
|
#include <sqlpp11/parameter_list.h>
|
||||||
#include <sqlpp11/prepared_remove.h>
|
#include <sqlpp11/prepared_remove.h>
|
||||||
@ -115,6 +116,7 @@ namespace sqlpp
|
|||||||
auto dynamic_remove(const Database&)
|
auto dynamic_remove(const Database&)
|
||||||
-> decltype(blank_remove_t<Database>())
|
-> decltype(blank_remove_t<Database>())
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { blank_remove_t<Database>() };
|
return { blank_remove_t<Database>() };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +124,7 @@ namespace sqlpp
|
|||||||
auto dynamic_remove_from(const Database&, Table table)
|
auto dynamic_remove_from(const Database&, Table table)
|
||||||
-> decltype(blank_remove_t<Database>().from(table))
|
-> decltype(blank_remove_t<Database>().from(table))
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { blank_remove_t<Database>().from(table) };
|
return { blank_remove_t<Database>().from(table) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <sqlpp11/statement.h>
|
#include <sqlpp11/statement.h>
|
||||||
|
|
||||||
#include <sqlpp11/noop.h>
|
#include <sqlpp11/noop.h>
|
||||||
|
#include <sqlpp11/connection.h>
|
||||||
#include <sqlpp11/select_flag_list.h>
|
#include <sqlpp11/select_flag_list.h>
|
||||||
#include <sqlpp11/select_column_list.h>
|
#include <sqlpp11/select_column_list.h>
|
||||||
#include <sqlpp11/from.h>
|
#include <sqlpp11/from.h>
|
||||||
@ -94,6 +95,7 @@ namespace sqlpp
|
|||||||
template<typename Database>
|
template<typename Database>
|
||||||
blank_select_t<Database> dynamic_select(const Database&)
|
blank_select_t<Database> dynamic_select(const Database&)
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { };
|
return { };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,7 @@ namespace sqlpp
|
|||||||
auto dynamic_select(const Database&, Columns... columns)
|
auto dynamic_select(const Database&, Columns... columns)
|
||||||
-> decltype(blank_select_t<Database>().columns(columns...))
|
-> decltype(blank_select_t<Database>().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...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define SQLPP_UPDATE_H
|
#define SQLPP_UPDATE_H
|
||||||
|
|
||||||
#include <sqlpp11/statement.h>
|
#include <sqlpp11/statement.h>
|
||||||
|
#include <sqlpp11/connection.h>
|
||||||
#include <sqlpp11/type_traits.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
#include <sqlpp11/parameter_list.h>
|
#include <sqlpp11/parameter_list.h>
|
||||||
#include <sqlpp11/prepared_update.h>
|
#include <sqlpp11/prepared_update.h>
|
||||||
@ -109,6 +109,7 @@ namespace sqlpp
|
|||||||
constexpr auto dynamic_update(const Database&, Table table)
|
constexpr auto dynamic_update(const Database&, Table table)
|
||||||
-> decltype(blank_update_t<Database>().from(table))
|
-> decltype(blank_update_t<Database>().from(table))
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<connection, Database>::value, "Invalid database parameter");
|
||||||
return { blank_update_t<Database>().from(table) };
|
return { blank_update_t<Database>().from(table) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user