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

Reduce remove_from to the generally supported set

USING is supported by postgresql
JOIN is supported by mysql
This commit is contained in:
Roland Bock 2024-10-06 10:01:15 +02:00
parent 0c8c0c5215
commit 412b4b0c95
3 changed files with 6 additions and 6 deletions

View File

@ -31,8 +31,7 @@
#include <sqlpp11/core/type_traits.h> #include <sqlpp11/core/type_traits.h>
#include <sqlpp11/core/database/prepared_remove.h> #include <sqlpp11/core/database/prepared_remove.h>
#include <sqlpp11/core/noop.h> #include <sqlpp11/core/noop.h>
#include <sqlpp11/core/clause/from.h> #include <sqlpp11/core/clause/single_table.h>
#include <sqlpp11/core/clause/using.h>
#include <sqlpp11/core/clause/where.h> #include <sqlpp11/core/clause/where.h>
namespace sqlpp namespace sqlpp
@ -91,10 +90,10 @@ namespace sqlpp
template <typename Context> template <typename Context>
auto to_sql_string(Context& , const remove_name_t&) -> std::string auto to_sql_string(Context& , const remove_name_t&) -> std::string
{ {
return "DELETE"; return "DELETE FROM ";
} }
using blank_remove_t = statement_t<remove_t, no_from_t, no_using_t, no_where_t<true>>; using blank_remove_t = statement_t<remove_t, no_single_table_t, no_where_t<true>>;
inline auto remove() -> blank_remove_t inline auto remove() -> blank_remove_t
{ {
@ -102,9 +101,9 @@ namespace sqlpp
} }
template <typename Table> template <typename Table>
auto remove_from(Table table) -> decltype(blank_remove_t().from(table)) auto remove_from(Table table) -> decltype(blank_remove_t().single_table(table))
{ {
return {blank_remove_t().from(table)}; return {blank_remove_t().single_table(table)};
} }
} // namespace sqlpp } // namespace sqlpp

View File

@ -27,6 +27,7 @@
*/ */
#include <sqlpp11/core/clause/remove.h> #include <sqlpp11/core/clause/remove.h>
#include <sqlpp11/postgresql/using.h>
#include <sqlpp11/postgresql/returning.h> #include <sqlpp11/postgresql/returning.h>
namespace sqlpp namespace sqlpp