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

Make g++-4.8 compile again

This commit is contained in:
rbock 2014-01-18 16:10:46 +01:00
parent 312e735d6d
commit 87302fa27f
26 changed files with 528 additions and 439 deletions

View File

@ -45,21 +45,24 @@ namespace sqlpp
Expression _expression;
};
template<typename Context, typename Expression, typename AliasProvider>
struct vendor::interpreter_t<Context, expression_alias_t<Expression, AliasProvider>>
{
using T = expression_alias_t<Expression, AliasProvider>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expression, typename AliasProvider>
struct interpreter_t<Context, expression_alias_t<Expression, AliasProvider>>
{
context << '(';
interpret(t._expression, context);
context << ") AS ";
context << T::_name_t::_get_name();
return context;
}
};
using T = expression_alias_t<Expression, AliasProvider>;
static Context& _(const T& t, Context& context)
{
context << '(';
interpret(t._expression, context);
context << ") AS ";
context << T::_name_t::_get_name();
return context;
}
};
}
}
#endif

View File

@ -75,26 +75,29 @@ namespace sqlpp
};
}
template<typename Context, typename Select>
struct vendor::interpreter_t<Context, vendor::any_t<Select>>
{
using T = vendor::any_t<Select>;
static Context& _(const T& t, Context& context)
{
context << "ANY(";
interpret(t._select, context);
context << ")";
return context;
}
};
template<typename T>
auto any(T&& t) -> typename vendor::any_t<typename operand_t<T, is_select_t>::type>
namespace vendor
{
return { std::forward<T>(t) };
}
template<typename Context, typename Select>
struct interpreter_t<Context, vendor::any_t<Select>>
{
using T = vendor::any_t<Select>;
static Context& _(const T& t, Context& context)
{
context << "ANY(";
interpret(t._select, context);
context << ")";
return context;
}
};
template<typename T>
auto any(T&& t) -> typename vendor::any_t<typename operand_t<T, is_select_t>::type>
{
return { std::forward<T>(t) };
}
}
}
#endif

View File

@ -74,25 +74,28 @@ namespace sqlpp
};
}
template<typename Context, typename Expr>
struct vendor::interpreter_t<Context, vendor::avg_t<Expr>>
{
using T = vendor::avg_t<Expr>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expr>
struct interpreter_t<Context, vendor::avg_t<Expr>>
{
context << "AVG(";
interpret(t._expr, context);
context << ")";
return context;
}
};
using T = vendor::avg_t<Expr>;
static Context& _(const T& t, Context& context)
{
context << "AVG(";
interpret(t._expr, context);
context << ")";
return context;
}
};
}
template<typename T>
auto avg(T&& t) -> typename vendor::avg_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
auto avg(T&& t) -> typename vendor::avg_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -78,18 +78,21 @@ namespace sqlpp
}
};
template<typename Context, typename... Args>
struct vendor::interpreter_t<Context, column_t<Args...>>
{
using T = column_t<Args...>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename... Args>
struct interpreter_t<Context, column_t<Args...>>
{
context << T::_table::_name_t::_get_name() << '.' << T::_name_t::_get_name();
return context;
}
};
using T = column_t<Args...>;
static Context& _(const T& t, Context& context)
{
context << T::_table::_name_t::_get_name() << '.' << T::_name_t::_get_name();
return context;
}
};
}
}
#endif

View File

@ -74,25 +74,28 @@ namespace sqlpp
};
}
template<typename Context, typename Expr>
struct vendor::interpreter_t<Context, vendor::count_t<Expr>>
{
using T = vendor::count_t<Expr>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expr>
struct interpreter_t<Context, vendor::count_t<Expr>>
{
context << "COUNT(";
interpret(t._expr, context);
context << ")";
return context;
}
};
using T = vendor::count_t<Expr>;
static Context& _(const T& t, Context& context)
{
context << "COUNT(";
interpret(t._expr, context);
context << ")";
return context;
}
};
}
template<typename T>
auto count(T&& t) -> typename vendor::count_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
auto count(T&& t) -> typename vendor::count_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -73,26 +73,29 @@ namespace sqlpp
};
}
template<typename Context, typename Select>
struct vendor::interpreter_t<Context, vendor::exists_t<Select>>
{
using T = vendor::exists_t<Select>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Select>
struct interpreter_t<Context, vendor::exists_t<Select>>
{
context << "EXISTS(";
interpret(t._select, context);
context << ")";
return context;
}
};
using T = vendor::exists_t<Select>;
static Context& _(const T& t, Context& context)
{
context << "EXISTS(";
interpret(t._select, context);
context << ")";
return context;
}
};
}
template<typename T>
auto exists(T&& t) -> typename vendor::exists_t<typename operand_t<T, is_select_t>::type>
{
return { std::forward<T>(t) };
}
auto exists(T&& t) -> typename vendor::exists_t<typename operand_t<T, is_select_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -67,17 +67,20 @@ namespace sqlpp
std::string _verbatim;
};
template<typename Context, typename ValueType>
struct vendor::interpreter_t<Context, verbatim_t<ValueType>>
{
using T = verbatim_t<ValueType>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename ValueType>
struct interpreter_t<Context, verbatim_t<ValueType>>
{
context << t._verbatim;
return context;
}
};
using T = verbatim_t<ValueType>;
static Context& _(const T& t, Context& context)
{
context << t._verbatim;
return context;
}
};
}
template<typename ValueType, typename StringType>
auto verbatim(StringType&& s) -> verbatim_t<ValueType>
@ -103,33 +106,36 @@ namespace sqlpp
_container_t _container;
};
template<typename Context, typename Container>
struct vendor::interpreter_t<Context, value_list_t<Container>>
{
using T = value_list_t<Container>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Container>
struct interpreter_t<Context, value_list_t<Container>>
{
bool first = true;
for (const auto& entry: t._container)
{
if (first)
first = false;
else
context << ',';
using T = value_list_t<Container>;
interpret(value(entry), context);
static Context& _(const T& t, Context& context)
{
bool first = true;
for (const auto& entry: t._container)
{
if (first)
first = false;
else
context << ',';
interpret(value(entry), context);
}
return context;
}
return context;
}
};
};
}
template<typename Container>
auto value_list(Container&& c) -> value_list_t<typename std::decay<Container>::type>
{
static_assert(not is_value_t<typename std::decay<Container>::type::value_type>::value, "value_list() is to be called with a container of non-sql-type like std::vector<int>, or std::list(string)");
return { std::forward<Container>(c) };
}
auto value_list(Container&& c) -> value_list_t<typename std::decay<Container>::type>
{
static_assert(not is_value_t<typename std::decay<Container>::type::value_type>::value, "value_list() is to be called with a container of non-sql-type like std::vector<int>, or std::list(string)");
return { std::forward<Container>(c) };
}
template<typename T>
constexpr const char* get_sql_name(const T&)

View File

@ -133,19 +133,22 @@ namespace sqlpp
InsertList _insert_list;
};
template<typename Context, typename Database, typename Table, typename InsertList>
struct vendor::interpreter_t<Context, insert_t<Database, Table, InsertList>>
{
using T = insert_t<Database, Table, InsertList>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Database, typename Table, typename InsertList>
struct interpreter_t<Context, insert_t<Database, Table, InsertList>>
{
context << "INSERT INTO ";
interpret(t._table, context);
interpret(t._insert_list, context);
return context;
}
};
using T = insert_t<Database, Table, InsertList>;
static Context& _(const T& t, Context& context)
{
context << "INSERT INTO ";
interpret(t._table, context);
interpret(t._insert_list, context);
return context;
}
};
}
template<typename Table>
insert_t<void, typename std::decay<Table>::type> insert_into(Table&& table)

View File

@ -141,24 +141,27 @@ namespace sqlpp
};
// FIXME: Need to check if db supports the join type. e.g. sqlite does not support right outer or full outer join
template<typename Context, typename JoinType, typename Lhs, typename Rhs, typename On>
struct vendor::interpreter_t<Context, join_t<JoinType, Lhs, Rhs, On>>
{
using T = join_t<JoinType, Lhs, Rhs, On>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename JoinType, typename Lhs, typename Rhs, typename On>
struct interpreter_t<Context, join_t<JoinType, Lhs, Rhs, On>>
{
static_assert(not vendor::is_noop<On>::value, "joined tables require on()");
interpret(t._lhs, context);
context << JoinType::_name;
context << " JOIN ";
context << "(";
interpret(t._rhs, context);
interpret(t._on, context);
return context;
}
};
using T = join_t<JoinType, Lhs, Rhs, On>;
static Context& _(const T& t, Context& context)
{
static_assert(not vendor::is_noop<On>::value, "joined tables require on()");
interpret(t._lhs, context);
context << JoinType::_name;
context << " JOIN ";
context << "(";
interpret(t._rhs, context);
interpret(t._on, context);
return context;
}
};
}
}
#endif

View File

@ -74,25 +74,28 @@ namespace sqlpp
};
}
template<typename Context, typename Expr>
struct vendor::interpreter_t<Context, vendor::max_t<Expr>>
{
using T = vendor::max_t<Expr>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expr>
struct interpreter_t<Context, vendor::max_t<Expr>>
{
context << "MAX(";
interpret(t._expr, context);
context << ")";
return context;
}
};
using T = vendor::max_t<Expr>;
static Context& _(const T& t, Context& context)
{
context << "MAX(";
interpret(t._expr, context);
context << ")";
return context;
}
};
}
template<typename T>
auto max(T&& t) -> typename vendor::max_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
auto max(T&& t) -> typename vendor::max_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -74,25 +74,28 @@ namespace sqlpp
};
}
template<typename Context, typename Expr>
struct vendor::interpreter_t<Context, vendor::min_t<Expr>>
{
using T = vendor::min_t<Expr>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expr>
struct interpreter_t<Context, vendor::min_t<Expr>>
{
context << "MIN(";
interpret(t._expr, context);
context << ")";
return context;
}
};
using T = vendor::min_t<Expr>;
static Context& _(const T& t, Context& context)
{
context << "MIN(";
interpret(t._expr, context);
context << ")";
return context;
}
};
}
template<typename T>
auto min(T&& t) -> typename vendor::min_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
auto min(T&& t) -> typename vendor::min_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -55,23 +55,26 @@ namespace sqlpp
std::tuple<NamedExpr...> _columns;
};
template<typename Context, typename AliasProvider, typename... NamedExpr>
struct vendor::interpreter_t<Context, multi_column_t<AliasProvider, NamedExpr...>>
{
using T = multi_column_t<AliasProvider, NamedExpr...>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename AliasProvider, typename... NamedExpr>
struct interpreter_t<Context, multi_column_t<AliasProvider, NamedExpr...>>
{
interpret_tuple(t._columns, ',', context);
return context;
}
};
using T = multi_column_t<AliasProvider, NamedExpr...>;
static Context& _(const T& t, Context& context)
{
interpret_tuple(t._columns, ',', context);
return context;
}
};
}
namespace detail
{
template<typename AliasProvider, typename... Expr>
using make_multi_column_t =
multi_column_t<typename std::decay<AliasProvider>::type, decltype(make_expression_tuple(std::declval<Expr>()...))>;
multi_column_t<typename std::decay<AliasProvider>::type, decltype(make_expression_tuple(std::declval<Expr>()...))>;
}
template<typename AliasProvider, typename... NamedExpr>

View File

@ -54,24 +54,27 @@ namespace sqlpp
vendor::interpretable_list_t<Database> _dynamic_expressions;
};
template<typename Context, typename Database, typename... Expr>
struct vendor::interpreter_t<Context, on_t<Database, Expr...>>
{
using T = on_t<Database, Expr...>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Database, typename... Expr>
struct interpreter_t<Context, on_t<Database, Expr...>>
{
if (sizeof...(Expr) == 0 and t._dynamic_expressions.empty())
return context;
context << " ON ";
interpret_tuple(t._expressions, " AND ", context);
if (sizeof...(Expr) and not t._dynamic_expressions.empty())
context << " AND ";
interpret_list(t._dynamic_expressions, " AND ", context);
return context;
}
};
using T = on_t<Database, Expr...>;
static Context& _(const T& t, Context& context)
{
if (sizeof...(Expr) == 0 and t._dynamic_expressions.empty())
return context;
context << " ON ";
interpret_tuple(t._expressions, " AND ", context);
if (sizeof...(Expr) and not t._dynamic_expressions.empty())
context << " AND ";
interpret_list(t._dynamic_expressions, " AND ", context);
return context;
}
};
}
}
#endif

View File

@ -49,17 +49,20 @@ namespace sqlpp
~parameter_t() = default;
};
template<typename Context, typename ValueType, typename NameType>
struct vendor::interpreter_t<Context, parameter_t<ValueType, NameType>>
{
using T = parameter_t<ValueType, NameType>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename ValueType, typename NameType>
struct interpreter_t<Context, parameter_t<ValueType, NameType>>
{
context << "?";
return context;
}
};
using T = parameter_t<ValueType, NameType>;
static Context& _(const T& t, Context& context)
{
context << "?";
return context;
}
};
}
template<typename NamedExpr>
auto parameter(NamedExpr&& namedExpr)

View File

@ -165,20 +165,23 @@ namespace sqlpp
Where _where;
};
template<typename Context, typename Database, typename Table, typename Using, typename Where>
struct vendor::interpreter_t<Context, remove_t<Database, Table, Using, Where>>
{
using T = remove_t<Database, Table, Using, Where>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Database, typename Table, typename Using, typename Where>
struct interpreter_t<Context, remove_t<Database, Table, Using, Where>>
{
context << "DELETE FROM ";
interpret(t._table, context);
interpret(t._using, context);
interpret(t._where, context);
return context;
}
};
using T = remove_t<Database, Table, Using, Where>;
static Context& _(const T& t, Context& context)
{
context << "DELETE FROM ";
interpret(t._table, context);
interpret(t._using, context);
interpret(t._where, context);
return context;
}
};
}
template<typename Table>
constexpr remove_t<void, typename std::decay<Table>::type> remove_from(Table&& table)

View File

@ -606,42 +606,44 @@ namespace sqlpp
Offset _offset;
};
template<typename Context,
typename Database,
typename Flags,
typename ExpressionList,
typename From,
typename Where,
typename GroupBy,
typename Having,
typename OrderBy,
typename Limit,
typename Offset
>
struct vendor::interpreter_t<Context, select_t<Database,
Flags,
ExpressionList,
From,
Where,
GroupBy,
Having,
OrderBy,
Limit,
Offset>>
{
using T = select_t<Database,
Flags,
ExpressionList,
From,
Where,
GroupBy,
Having,
OrderBy,
Limit,
Offset>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context,
typename Database,
typename Flags,
typename ExpressionList,
typename From,
typename Where,
typename GroupBy,
typename Having,
typename OrderBy,
typename Limit,
typename Offset
>
struct interpreter_t<Context, select_t<Database,
Flags,
ExpressionList,
From,
Where,
GroupBy,
Having,
OrderBy,
Limit,
Offset>>
{
using T = select_t<Database,
Flags,
ExpressionList,
From,
Where,
GroupBy,
Having,
OrderBy,
Limit,
Offset>;
static Context& _(const T& t, Context& context)
{
context << "SELECT ";
interpret(t._flags, context);
@ -655,8 +657,9 @@ namespace sqlpp
interpret(t._offset, context);
return context;
}
};
}
};
}
// construct select flag list
@ -664,7 +667,7 @@ namespace sqlpp
{
template<typename... Expr>
using make_select_flag_list_t =
vendor::select_flag_list_t<decltype(make_flag_tuple(std::declval<Expr>()...))>;
vendor::select_flag_list_t<decltype(make_flag_tuple(std::declval<Expr>()...))>;
}
// construct select expression list
@ -672,7 +675,7 @@ namespace sqlpp
{
template<typename... Expr>
using make_select_expression_list_t =
vendor::select_expression_list_t<void, decltype(make_expression_tuple(std::declval<Expr>()...))>;
vendor::select_expression_list_t<void, decltype(make_expression_tuple(std::declval<Expr>()...))>;
}
template<typename... NamedExpr>
@ -681,7 +684,7 @@ namespace sqlpp
{
return {
{ detail::make_flag_tuple(std::forward<NamedExpr>(namedExpr)...) },
{ detail::make_expression_tuple(std::forward<NamedExpr>(namedExpr)...) }
{ detail::make_expression_tuple(std::forward<NamedExpr>(namedExpr)...) }
};
}
template<typename Db, typename... NamedExpr>
@ -690,7 +693,7 @@ namespace sqlpp
{
return {
{ detail::make_flag_tuple(std::forward<NamedExpr>(namedExpr)...) },
{ detail::make_expression_tuple(std::forward<NamedExpr>(namedExpr)...) }
{ detail::make_expression_tuple(std::forward<NamedExpr>(namedExpr)...) }
};
}

View File

@ -75,25 +75,28 @@ namespace sqlpp
};
}
template<typename Context, typename Select>
struct vendor::interpreter_t<Context, vendor::some_t<Select>>
{
using T = vendor::some_t<Select>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Select>
struct interpreter_t<Context, vendor::some_t<Select>>
{
context << "SOME(";
interpret(t._select, context);
context << ")";
return context;
}
};
using T = vendor::some_t<Select>;
static Context& _(const T& t, Context& context)
{
context << "SOME(";
interpret(t._select, context);
context << ")";
return context;
}
};
}
template<typename T>
auto some(T&& t) -> typename vendor::some_t<typename operand_t<T, is_select_t>::type>
{
return { std::forward<T>(t) };
}
auto some(T&& t) -> typename vendor::some_t<typename operand_t<T, is_select_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -43,27 +43,30 @@ namespace sqlpp
Expression _expression;
};
template<typename Context, typename Expression, sort_type SortType>
struct vendor::interpreter_t<Context, sort_order_t<Expression, SortType>>
{
using T = sort_order_t<Expression, SortType>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expression, sort_type SortType>
struct interpreter_t<Context, sort_order_t<Expression, SortType>>
{
interpret(t._expression, context);
switch(SortType)
{
case sort_type::asc:
context << " ASC";
break;
default:
context << " DESC";
break;
}
return context;
}
};
using T = sort_order_t<Expression, SortType>;
static Context& _(const T& t, Context& context)
{
interpret(t._expression, context);
switch(SortType)
{
case sort_type::asc:
context << " ASC";
break;
default:
context << " DESC";
break;
}
return context;
}
};
}
}
#endif

View File

@ -74,25 +74,28 @@ namespace sqlpp
};
}
template<typename Context, typename Expr>
struct vendor::interpreter_t<Context, vendor::sum_t<Expr>>
{
using T = vendor::sum_t<Expr>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Expr>
struct interpreter_t<Context, vendor::sum_t<Expr>>
{
context << "SUM(";
interpret(t._expr, context);
context << ")";
return context;
}
};
using T = vendor::sum_t<Expr>;
static Context& _(const T& t, Context& context)
{
context << "SUM(";
interpret(t._expr, context);
context << ")";
return context;
}
};
}
template<typename T>
auto sum(T&& t) -> typename vendor::sum_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
auto sum(T&& t) -> typename vendor::sum_t<typename operand_t<T, is_value_t>::type>
{
return { std::forward<T>(t) };
}
}

View File

@ -99,19 +99,22 @@ namespace sqlpp
return {};
}
template<typename Context, typename X>
struct vendor::interpreter_t<Context, X, typename std::enable_if<std::is_base_of<table_base_t, X>::value and not is_pseudo_table_t<X>::value, void>::type>
{
using T = X;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename X>
struct interpreter_t<Context, X, typename std::enable_if<std::is_base_of<table_base_t, X>::value and not is_pseudo_table_t<X>::value, void>::type>
{
context << T::_name_t::_get_name();
return context;
}
};
using T = X;
static Context& _(const T& t, Context& context)
{
context << T::_name_t::_get_name();
return context;
}
};
}
}
#endif

View File

@ -61,20 +61,23 @@ namespace sqlpp
Table _table;
};
template<typename Context, typename X>
struct vendor::interpreter_t<Context, X, typename std::enable_if<std::is_base_of<table_alias_base_t, X>::value, void>::type>
{
using T = X;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename X>
struct interpreter_t<Context, X, typename std::enable_if<std::is_base_of<table_alias_base_t, X>::value, void>::type>
{
context << "(";
interpret(t._table, context);
context << ") AS " << T::_name_t::_get_name();
return context;
}
};
using T = X;
static Context& _(const T& t, Context& context)
{
context << "(";
interpret(t._table, context);
context << ") AS " << T::_name_t::_get_name();
return context;
}
};
}
}
#endif

View File

@ -53,16 +53,19 @@ namespace sqlpp
_operand_t _value;
};
template<typename Context, typename Type>
struct vendor::interpreter_t<Context, tvin_t<Type>>
{
using T = tvin_t<Type>;
static void _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Type>
struct interpreter_t<Context, tvin_t<Type>>
{
static_assert(detail::wrong<T>::value, "tvin() must not be used with anything but =, ==, != and !");
}
};
using T = tvin_t<Type>;
static void _(const T& t, Context& context)
{
static_assert(detail::wrong<T>::value, "tvin() must not be used with anything but =, ==, != and !");
}
};
}
template<typename T>
struct tvin_wrap_t
@ -104,31 +107,33 @@ namespace sqlpp
typename tvin_t<T>::_operand_t _value;
};
template<typename Context, typename Type>
struct vendor::interpreter_t<Context, tvin_wrap_t<Type>>
{
using T = tvin_wrap_t<Type>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Type>
struct interpreter_t<Context, tvin_wrap_t<Type>>
{
if (t._is_trivial())
{
context << "NULL";
}
else
{
interpret(t._value, context);
}
return context;
}
};
using T = tvin_wrap_t<Type>;
static Context& _(const T& t, Context& context)
{
if (t._is_trivial())
{
context << "NULL";
}
else
{
interpret(t._value, context);
}
return context;
}
};
}
template<typename T>
auto tvin(T t) -> tvin_t<typename std::decay<T>::type>
{
return {t};
}
auto tvin(T t) -> tvin_t<typename std::decay<T>::type>
{
return {t};
}
}

View File

@ -167,25 +167,28 @@ namespace sqlpp
Where _where;
};
template<typename Context,
typename Database,
typename Table,
typename Assignments,
typename Where
>
struct vendor::interpreter_t<Context, update_t<Database, Table, Assignments, Where>>
{
using T = update_t<Database, Table, Assignments, Where>;
namespace vendor
{
template<typename Context,
typename Database,
typename Table,
typename Assignments,
typename Where
>
struct interpreter_t<Context, update_t<Database, Table, Assignments, Where>>
{
using T = update_t<Database, Table, Assignments, Where>;
static Context& _(const T& t, Context& context)
{
context << "UPDATE ";
interpret(t._table, context);
interpret(t._assignments, context);
interpret(t._where, context);
return context;
}
};
static Context& _(const T& t, Context& context)
{
context << "UPDATE ";
interpret(t._table, context);
interpret(t._assignments, context);
interpret(t._where, context);
return context;
}
};
}
template<typename Table>
constexpr update_t<void, typename std::decay<Table>::type> update(Table&& table)

View File

@ -45,15 +45,18 @@ namespace sqlpp
};
static constexpr all_t all = {};
template<typename Context>
struct vendor::interpreter_t<Context, all_t>
{
static Context& _(const all_t&, Context& context)
namespace vendor
{
template<typename Context>
struct interpreter_t<Context, all_t>
{
context << "ALL";
return context;
}
};
static Context& _(const all_t&, Context& context)
{
context << "ALL";
return context;
}
};
}
struct distinct_t
{
@ -64,15 +67,18 @@ namespace sqlpp
};
static constexpr distinct_t distinct = {};
template<typename Context>
struct vendor::interpreter_t<Context, distinct_t>
{
static Context& _(const distinct_t&, Context& context)
namespace vendor
{
template<typename Context>
struct interpreter_t<Context, distinct_t>
{
context << "DISTINCT";
return context;
}
};
static Context& _(const distinct_t&, Context& context)
{
context << "DISTINCT";
return context;
}
};
}
struct straight_join_t
{
@ -83,15 +89,18 @@ namespace sqlpp
};
static constexpr straight_join_t straight_join = {};
template<typename Context>
struct vendor::interpreter_t<Context, straight_join_t>
{
static Context& _(const straight_join_t&, Context& context)
namespace vendor
{
template<typename Context>
struct interpreter_t<Context, straight_join_t>
{
context << "STRAIGHT_JOIN";
return context;
}
};
static Context& _(const straight_join_t&, Context& context)
{
context << "STRAIGHT_JOIN";
return context;
}
};
}
namespace vendor
{

View File

@ -70,18 +70,21 @@ namespace sqlpp
Select _select;
};
template<typename Context, typename Select, typename... NamedExpr>
struct vendor::interpreter_t<Context, select_pseudo_table_t<Select, NamedExpr...>>
{
using T = select_pseudo_table_t<Select, NamedExpr...>;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context, typename Select, typename... NamedExpr>
struct interpreter_t<Context, select_pseudo_table_t<Select, NamedExpr...>>
{
interpret(t._select, context);
return context;
}
};
using T = select_pseudo_table_t<Select, NamedExpr...>;
static Context& _(const T& t, Context& context)
{
interpret(t._select, context);
return context;
}
};
}
}
#endif

View File

@ -65,17 +65,20 @@ namespace sqlpp
std::string _name;
};
template<typename Context>
struct vendor::interpreter_t<Context, verbatim_table_t>
{
using T = verbatim_table_t;
static Context& _(const T& t, Context& context)
namespace vendor
{
template<typename Context>
struct interpreter_t<Context, verbatim_table_t>
{
context << t._name;
return context;
}
};
using T = verbatim_table_t;
static Context& _(const T& t, Context& context)
{
context << t._name;
return context;
}
};
}
verbatim_table_t verbatim_table(std::string name)