From 1e1b388a67714c52ab5eaf65b1ac7a67cd26d0db Mon Sep 17 00:00:00 2001 From: rbock Date: Fri, 15 Apr 2016 09:37:34 +0200 Subject: [PATCH] Added factory functions for several select sub clauses --- include/sqlpp11/group_by.h | 13 +++++++++++++ include/sqlpp11/limit.h | 14 +++++++++++++- include/sqlpp11/offset.h | 14 +++++++++++++- include/sqlpp11/order_by.h | 13 +++++++++++++ include/sqlpp11/select_column_list.h | 7 +++++++ include/sqlpp11/select_flag_list.h | 13 +++++++++++++ include/sqlpp11/union.h | 14 +++++++++++++- 7 files changed, 85 insertions(+), 3 deletions(-) diff --git a/include/sqlpp11/group_by.h b/include/sqlpp11/group_by.h index fa969b56..8dd9deb1 100644 --- a/include/sqlpp11/group_by.h +++ b/include/sqlpp11/group_by.h @@ -271,6 +271,19 @@ namespace sqlpp return context; } }; + + template + auto group_by(T&&... t) -> decltype(statement_t().group_by(std::forward(t)...)) + { + return statement_t().group_by(std::forward(t)...); + } + + template + auto dynamic_group_by(const Database&, T&&... t) + -> decltype(statement_t().dynamic_group_by(std::forward(t)...)) + { + return statement_t().dynamic_group_by(std::forward(t)...); + } } #endif diff --git a/include/sqlpp11/limit.h b/include/sqlpp11/limit.h index 65952e0a..2682ab87 100644 --- a/include/sqlpp11/limit.h +++ b/include/sqlpp11/limit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, Roland Bock + * Copyright (c) 2013-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -312,6 +312,18 @@ namespace sqlpp return context; } }; + + template + auto limit(T&& t) -> decltype(statement_t().limit(std::forward(t))) + { + return statement_t().limit(std::forward(t)); + } + + template + auto dynamic_limit(const Database&) -> decltype(statement_t().dynamic_limit()) + { + return statement_t().dynamic_limit(); + } } #endif diff --git a/include/sqlpp11/offset.h b/include/sqlpp11/offset.h index ed38da23..9251a6d2 100644 --- a/include/sqlpp11/offset.h +++ b/include/sqlpp11/offset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, Roland Bock + * Copyright (c) 2013-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -328,6 +328,18 @@ namespace sqlpp return context; } }; + + template + auto offset(T&& t) -> decltype(statement_t().offset(std::forward(t))) + { + return statement_t().offset(std::forward(t)); + } + + template + auto dynamic_offset(const Database&) -> decltype(statement_t().dynamic_offset()) + { + return statement_t().dynamic_offset(); + } } #endif diff --git a/include/sqlpp11/order_by.h b/include/sqlpp11/order_by.h index 53d9c87f..4ac698bf 100644 --- a/include/sqlpp11/order_by.h +++ b/include/sqlpp11/order_by.h @@ -268,6 +268,19 @@ namespace sqlpp return context; } }; + + template + auto order_by(T&&... t) -> decltype(statement_t().order_by(std::forward(t)...)) + { + return statement_t().order_by(std::forward(t)...); + } + + template + auto dynamic_order_by(const Database&, T&&... t) + -> decltype(statement_t().dynamic_order_by(std::forward(t)...)) + { + return statement_t().dynamic_order_by(std::forward(t)...); + } } #endif diff --git a/include/sqlpp11/select_column_list.h b/include/sqlpp11/select_column_list.h index 36ed87a2..ed99ff2e 100644 --- a/include/sqlpp11/select_column_list.h +++ b/include/sqlpp11/select_column_list.h @@ -446,6 +446,13 @@ namespace sqlpp { return statement_t().columns(std::forward(t)...); } + + template + auto dynamic_select_columns(const Database&, T&&... t) + -> decltype(statement_t().dynamic_columns(std::forward(t)...)) + { + return statement_t().dynamic_columns(std::forward(t)...); + } } #endif diff --git a/include/sqlpp11/select_flag_list.h b/include/sqlpp11/select_flag_list.h index e8d0bd02..250c5e4d 100644 --- a/include/sqlpp11/select_flag_list.h +++ b/include/sqlpp11/select_flag_list.h @@ -258,6 +258,19 @@ namespace sqlpp return context; } }; + + template + auto select_flags(T&& t) -> decltype(statement_t().flags(std::forward(t))) + { + return statement_t().flags(std::forward(t)); + } + + template + auto dynamic_select_flags(const Database&, T&& t) + -> decltype(statement_t().dynamic_flags(std::forward(t))) + { + return statement_t().dynamic_flags(std::forward(t)); + } } #endif diff --git a/include/sqlpp11/union.h b/include/sqlpp11/union.h index 9011bd4c..49dd128e 100644 --- a/include/sqlpp11/union.h +++ b/include/sqlpp11/union.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, Roland Bock + * Copyright (c) 2013-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -250,6 +250,18 @@ namespace sqlpp } }; }; + + template + auto union_all(T&& t) -> decltype(statement_t().union_all(std::forward(t))) + { + return statement_t().union_all(std::forward(t)); + } + + template + auto union_distinct(T&& t) -> decltype(statement_t().union_distinct(std::forward(t))) + { + return statement_t().union_distinct(std::forward(t)); + } } #endif