mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Re-animated all tests
This commit is contained in:
parent
87302fa27f
commit
24b44fae65
@ -63,14 +63,9 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using _value_type = boolean;
|
using _value_type = boolean;
|
||||||
|
|
||||||
_parameter_t(const std::true_type&):
|
_parameter_t():
|
||||||
_value(false),
|
_value(false),
|
||||||
_is_null(false)
|
_is_null(true)
|
||||||
{}
|
|
||||||
|
|
||||||
_parameter_t(const std::false_type&):
|
|
||||||
_value(false),
|
|
||||||
_is_null(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
_parameter_t(const _cpp_value_type& value):
|
_parameter_t(const _cpp_value_type& value):
|
||||||
@ -186,14 +181,14 @@ namespace sqlpp
|
|||||||
vendor::binary_expression_t<Base, and_, typename _constraint<T>::type> operator and(T&& t) const
|
vendor::binary_expression_t<Base, and_, typename _constraint<T>::type> operator and(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, or_, typename _constraint<T>::type> operator or(T&& t) const
|
vendor::binary_expression_t<Base, or_, typename _constraint<T>::type> operator or(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
vendor::not_t<Base> operator not() const
|
vendor::not_t<Base> operator not() const
|
||||||
|
@ -53,7 +53,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
_parameter_t():
|
_parameter_t():
|
||||||
_value(0),
|
_value(0),
|
||||||
_is_null(false)
|
_is_null(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
_parameter_t(const _cpp_value_type& value):
|
_parameter_t(const _cpp_value_type& value):
|
||||||
@ -195,28 +195,28 @@ namespace sqlpp
|
|||||||
vendor::binary_expression_t<Base, plus_, typename _constraint<T>::type> operator +(T&& t) const
|
vendor::binary_expression_t<Base, plus_, typename _constraint<T>::type> operator +(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, minus_, typename _constraint<T>::type> operator -(T&& t) const
|
vendor::binary_expression_t<Base, minus_, typename _constraint<T>::type> operator -(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, multiplies_, typename _constraint<T>::type> operator *(T&& t) const
|
vendor::binary_expression_t<Base, multiplies_, typename _constraint<T>::type> operator *(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, divides_, typename _constraint<T>::type> operator /(T&& t) const
|
vendor::binary_expression_t<Base, divides_, typename _constraint<T>::type> operator /(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -51,14 +51,9 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using _value_type = integral;
|
using _value_type = integral;
|
||||||
|
|
||||||
_parameter_t(const std::true_type&):
|
_parameter_t():
|
||||||
_value(0),
|
_value(0),
|
||||||
_is_null(false)
|
_is_null(true)
|
||||||
{}
|
|
||||||
|
|
||||||
_parameter_t(const std::false_type&):
|
|
||||||
_value(0),
|
|
||||||
_is_null(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit _parameter_t(const _cpp_value_type& value):
|
explicit _parameter_t(const _cpp_value_type& value):
|
||||||
@ -202,28 +197,28 @@ namespace sqlpp
|
|||||||
vendor::binary_expression_t<Base, plus_<T>, typename _constraint<T>::type> operator +(T&& t) const
|
vendor::binary_expression_t<Base, plus_<T>, typename _constraint<T>::type> operator +(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, minus_<T>, typename _constraint<T>::type> operator -(T&& t) const
|
vendor::binary_expression_t<Base, minus_<T>, typename _constraint<T>::type> operator -(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, multiplies_<T>, typename _constraint<T>::type> operator *(T&& t) const
|
vendor::binary_expression_t<Base, multiplies_<T>, typename _constraint<T>::type> operator *(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
vendor::binary_expression_t<Base, divides_, typename _constraint<T>::type> operator /(T&& t) const
|
vendor::binary_expression_t<Base, divides_, typename _constraint<T>::type> operator /(T&& t) const
|
||||||
{
|
{
|
||||||
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
static_assert(not is_multi_expression_t<Base>::value, "multi-expression cannot be used as left hand side operand");
|
||||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
return { *static_cast<const Base*>(this), {std::forward<T>(t)} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
struct serializer
|
struct serializer_t
|
||||||
{
|
{
|
||||||
serializer(std::ostream& os):
|
serializer_t(std::ostream& os):
|
||||||
_os(os)
|
_os(os)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#ifndef SQLPP_H
|
#ifndef SQLPP_H
|
||||||
#define SQLPP_H
|
#define SQLPP_H
|
||||||
|
|
||||||
|
#include <sqlpp11/alias_provider.h>
|
||||||
#include <sqlpp11/column_types.h>
|
#include <sqlpp11/column_types.h>
|
||||||
#include <sqlpp11/insert.h>
|
#include <sqlpp11/insert.h>
|
||||||
#include <sqlpp11/remove.h>
|
#include <sqlpp11/remove.h>
|
||||||
|
@ -51,14 +51,9 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using _value_type = integral;
|
using _value_type = integral;
|
||||||
|
|
||||||
_parameter_t(const std::true_type&):
|
_parameter_t():
|
||||||
_value(""),
|
_value(""),
|
||||||
_is_null(false)
|
_is_null(true)
|
||||||
{}
|
|
||||||
|
|
||||||
_parameter_t(const std::false_type&):
|
|
||||||
_value(""),
|
|
||||||
_is_null(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
_parameter_t(const _cpp_value_type& value):
|
_parameter_t(const _cpp_value_type& value):
|
||||||
|
2
include/sqlpp11/vendor/concat.h
vendored
2
include/sqlpp11/vendor/concat.h
vendored
@ -39,7 +39,7 @@ namespace sqlpp
|
|||||||
struct concat_t: public First::_value_type::template operators<concat_t<First, Args...>>
|
struct concat_t: public First::_value_type::template operators<concat_t<First, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");
|
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");
|
||||||
using _valid_args = typename detail::make_set_if_not<is_text_t, First, Args...>::type;
|
using _valid_args = typename ::sqlpp::detail::make_set_if_not<is_text_t, First, Args...>::type;
|
||||||
static_assert(_valid_args::size::value == 0, "at least one non-text argument detected in concat()");
|
static_assert(_valid_args::size::value == 0, "at least one non-text argument detected in concat()");
|
||||||
|
|
||||||
struct _value_type: public First::_value_type::_base_value_type
|
struct _value_type: public First::_value_type::_base_value_type
|
||||||
|
6
include/sqlpp11/vendor/insert_list.h
vendored
6
include/sqlpp11/vendor/insert_list.h
vendored
@ -84,14 +84,14 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value or sizeof...(Assignments), "at least one select expression required in set()");
|
static_assert(_is_dynamic::value or sizeof...(Assignments), "at least one select expression required in set()");
|
||||||
|
|
||||||
// check for duplicate assignments
|
// check for duplicate assignments
|
||||||
static_assert(not detail::has_duplicates<Assignments...>::value, "at least one duplicate argument detected in set()");
|
static_assert(not ::sqlpp::detail::has_duplicates<Assignments...>::value, "at least one duplicate argument detected in set()");
|
||||||
|
|
||||||
// check for invalid assignments
|
// check for invalid assignments
|
||||||
using _assignment_set = typename detail::make_set_if<is_assignment_t, Assignments...>::type;
|
using _assignment_set = typename ::sqlpp::detail::make_set_if<is_assignment_t, Assignments...>::type;
|
||||||
static_assert(_assignment_set::size::value == sizeof...(Assignments), "at least one argument is not an assignment in set()");
|
static_assert(_assignment_set::size::value == sizeof...(Assignments), "at least one argument is not an assignment in set()");
|
||||||
|
|
||||||
// check for prohibited assignments
|
// check for prohibited assignments
|
||||||
using _prohibited_assignment_set = typename detail::make_set_if<must_not_insert_t, typename Assignments::column_type...>::type;
|
using _prohibited_assignment_set = typename ::sqlpp::detail::make_set_if<must_not_insert_t, typename Assignments::column_type...>::type;
|
||||||
static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()");
|
static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()");
|
||||||
|
|
||||||
insert_list_t(Assignments... assignment):
|
insert_list_t(Assignments... assignment):
|
||||||
|
11
include/sqlpp11/vendor/interpretable.h
vendored
11
include/sqlpp11/vendor/interpretable.h
vendored
@ -30,6 +30,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sqlpp11/serializer.h>
|
#include <sqlpp11/serializer.h>
|
||||||
#include <sqlpp11/parameter_list.h>
|
#include <sqlpp11/parameter_list.h>
|
||||||
|
#include <sqlpp11/interpret.h>
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@ namespace sqlpp
|
|||||||
template<typename Db>
|
template<typename Db>
|
||||||
struct interpretable_t
|
struct interpretable_t
|
||||||
{
|
{
|
||||||
using _context_t = typename Db::context;
|
using _context_t = typename Db::_context_t;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
interpretable_t(T t):
|
interpretable_t(T t):
|
||||||
@ -51,7 +52,7 @@ namespace sqlpp
|
|||||||
interpretable_t& operator=(interpretable_t&&) = default;
|
interpretable_t& operator=(interpretable_t&&) = default;
|
||||||
~interpretable_t() = default;
|
~interpretable_t() = default;
|
||||||
|
|
||||||
sqlpp::serializer& interpret(sqlpp::serializer& context) const
|
sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const
|
||||||
{
|
{
|
||||||
return _impl->interpret(context);
|
return _impl->interpret(context);
|
||||||
}
|
}
|
||||||
@ -64,8 +65,8 @@ namespace sqlpp
|
|||||||
private:
|
private:
|
||||||
struct _impl_base
|
struct _impl_base
|
||||||
{
|
{
|
||||||
virtual sqlpp::serializer& interpret(sqlpp::serializer& context) const = 0;
|
virtual sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const = 0;
|
||||||
virtual _context_t interpret(_context_t& context) const = 0;
|
virtual _context_t& interpret(_context_t& context) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -80,7 +81,7 @@ namespace sqlpp
|
|||||||
_t(std::move(t))
|
_t(std::move(t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
sqlpp::serializer& interpret(sqlpp::serializer& context) const
|
sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const
|
||||||
{
|
{
|
||||||
sqlpp::interpret(_t, context);
|
sqlpp::interpret(_t, context);
|
||||||
return context;
|
return context;
|
||||||
|
2
include/sqlpp11/vendor/interpretable_list.h
vendored
2
include/sqlpp11/vendor/interpretable_list.h
vendored
@ -91,7 +91,7 @@ namespace sqlpp
|
|||||||
context << separator;
|
context << separator;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
interpret(t, context);
|
interpret(entry, context);
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
1
include/sqlpp11/vendor/like.h
vendored
1
include/sqlpp11/vendor/like.h
vendored
@ -40,6 +40,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
static_assert(is_text_t<Operand>::value, "Operand for like() has to be a text");
|
static_assert(is_text_t<Operand>::value, "Operand for like() has to be a text");
|
||||||
static_assert(is_text_t<Pattern>::value, "Pattern for like() has to be a text");
|
static_assert(is_text_t<Pattern>::value, "Pattern for like() has to be a text");
|
||||||
|
using _parameter_tuple_t = std::tuple<Operand, Pattern>;
|
||||||
|
|
||||||
struct _value_type: public boolean
|
struct _value_type: public boolean
|
||||||
{
|
{
|
||||||
|
8
include/sqlpp11/vendor/named_interpretable.h
vendored
8
include/sqlpp11/vendor/named_interpretable.h
vendored
@ -38,7 +38,7 @@ namespace sqlpp
|
|||||||
template<typename Db>
|
template<typename Db>
|
||||||
struct named_interpretable_t
|
struct named_interpretable_t
|
||||||
{
|
{
|
||||||
using _context_t = typename Db::context;
|
using _context_t = typename Db::_context_t;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
named_interpretable_t(T t):
|
named_interpretable_t(T t):
|
||||||
@ -51,7 +51,7 @@ namespace sqlpp
|
|||||||
named_interpretable_t& operator=(named_interpretable_t&&) = default;
|
named_interpretable_t& operator=(named_interpretable_t&&) = default;
|
||||||
~named_interpretable_t() = default;
|
~named_interpretable_t() = default;
|
||||||
|
|
||||||
sqlpp::serializer& interpret(sqlpp::serializer& context) const
|
sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const
|
||||||
{
|
{
|
||||||
return _impl->interpret(context);
|
return _impl->interpret(context);
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ namespace sqlpp
|
|||||||
private:
|
private:
|
||||||
struct _impl_base
|
struct _impl_base
|
||||||
{
|
{
|
||||||
virtual sqlpp::serializer& interpret(sqlpp::serializer& context) const = 0;
|
virtual sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const = 0;
|
||||||
virtual _context_t& interpret(_context_t& context) const = 0;
|
virtual _context_t& interpret(_context_t& context) const = 0;
|
||||||
virtual std::string _get_name() const = 0;
|
virtual std::string _get_name() const = 0;
|
||||||
};
|
};
|
||||||
@ -86,7 +86,7 @@ namespace sqlpp
|
|||||||
_t(std::move(t))
|
_t(std::move(t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
sqlpp::serializer& interpret(sqlpp::serializer& context) const
|
sqlpp::serializer_t& interpret(sqlpp::serializer_t& context) const
|
||||||
{
|
{
|
||||||
sqlpp::interpret(_t, context);
|
sqlpp::interpret(_t, context);
|
||||||
return context;
|
return context;
|
||||||
|
@ -135,9 +135,6 @@ namespace sqlpp
|
|||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
using _parameter_tuple_t = std::tuple<NamedExpr...>;
|
using _parameter_tuple_t = std::tuple<NamedExpr...>;
|
||||||
|
|
||||||
// check for at least one expression
|
|
||||||
static_assert(_is_dynamic::value or sizeof...(NamedExpr), "at least one select expression required");
|
|
||||||
|
|
||||||
// check for duplicate select expressions
|
// check for duplicate select expressions
|
||||||
static_assert(not ::sqlpp::detail::has_duplicates<NamedExpr...>::value, "at least one duplicate argument detected");
|
static_assert(not ::sqlpp::detail::has_duplicates<NamedExpr...>::value, "at least one duplicate argument detected");
|
||||||
|
|
||||||
@ -191,6 +188,9 @@ namespace sqlpp
|
|||||||
|
|
||||||
static Context& _(const T& t, Context& context)
|
static Context& _(const T& t, Context& context)
|
||||||
{
|
{
|
||||||
|
// check for at least one expression
|
||||||
|
static_assert(T::_is_dynamic::value or sizeof...(NamedExpr), "at least one select expression required");
|
||||||
|
|
||||||
interpret_tuple(t._expressions, ',', context);
|
interpret_tuple(t._expressions, ',', context);
|
||||||
if (sizeof...(NamedExpr) and not t._dynamic_expressions.empty())
|
if (sizeof...(NamedExpr) and not t._dynamic_expressions.empty())
|
||||||
context << ',';
|
context << ',';
|
||||||
|
@ -4,10 +4,10 @@ macro (build_and_run arg)
|
|||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
||||||
build_and_run(InterpretTest)
|
build_and_run(InterpretTest)
|
||||||
#build_and_run(InsertTest)
|
build_and_run(InsertTest)
|
||||||
#build_and_run(RemoveTest)
|
build_and_run(RemoveTest)
|
||||||
#build_and_run(UpdateTest)
|
build_and_run(UpdateTest)
|
||||||
#build_and_run(SelectTest)
|
build_and_run(SelectTest)
|
||||||
#build_and_run(FunctionTest)
|
build_and_run(FunctionTest)
|
||||||
#build_and_run(PreparedTest)
|
build_and_run(PreparedTest)
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "TabSample.h"
|
#include "TabSample.h"
|
||||||
#include "MockDb.h"
|
#include "MockDb.h"
|
||||||
|
#include <sqlpp11/alias_provider.h>
|
||||||
#include <sqlpp11/select.h>
|
#include <sqlpp11/select.h>
|
||||||
#include <sqlpp11/functions.h>
|
#include <sqlpp11/functions.h>
|
||||||
#include <sqlpp11/connection.h>
|
#include <sqlpp11/connection.h>
|
||||||
@ -32,7 +33,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
DbMock db = {};
|
DbMock db = {};
|
||||||
SQLPP_ALIAS_PROVIDER_GENERATOR(kaesekuchen);
|
SQLPP_ALIAS_PROVIDER(kaesekuchen);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
DbMock db;
|
DbMock db;
|
||||||
|
DbMock::_context_t printer(std::cerr);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -56,11 +57,11 @@ int main()
|
|||||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_into(t).serialize(std::cerr, db); std::cerr << "\n";
|
interpret(insert_into(t), printer).flush();
|
||||||
insert_into(t).set(t.beta = "kirschauflauf").serialize(std::cerr, db); std::cerr << "\n";
|
interpret(insert_into(t).set(t.beta = "kirschauflauf"), printer).flush();
|
||||||
auto i = dynamic_insert_into(db, t).dynamic_set();
|
auto i = dynamic_insert_into(db, t).dynamic_set();
|
||||||
i = i.add_set(t.beta = "kirschauflauf");
|
i = i.add_set(t.beta = "kirschauflauf");
|
||||||
i.serialize(std::cerr, db); std::cerr << "\n";
|
interpret(i, printer).flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
DbMock db = {};
|
DbMock db = {};
|
||||||
DbMock::context printer(std::cerr);
|
DbMock::_context_t printer(std::cerr);
|
||||||
SQLPP_ALIAS_PROVIDER(kaesekuchen);
|
SQLPP_ALIAS_PROVIDER(kaesekuchen);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -27,66 +27,14 @@
|
|||||||
#define SQLPP_MOCK_DB_H
|
#define SQLPP_MOCK_DB_H
|
||||||
|
|
||||||
#include <sqlpp11/connection.h>
|
#include <sqlpp11/connection.h>
|
||||||
|
#include <sqlpp11/serializer.h>
|
||||||
|
|
||||||
class DbMock: public sqlpp::connection
|
struct DbMock: public sqlpp::connection
|
||||||
{
|
{
|
||||||
public:
|
struct _context_t : public sqlpp::serializer_t
|
||||||
struct context
|
|
||||||
{
|
{
|
||||||
using _database_t = DbMock;
|
_context_t(std::ostream& os): sqlpp::serializer_t(os) {}
|
||||||
context(std::ostream& os):
|
|
||||||
_os(os)
|
|
||||||
{}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
std::ostream& operator<<(T t)
|
|
||||||
{
|
|
||||||
return _os << t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void flush()
|
|
||||||
{
|
|
||||||
_os << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string escape(std::string arg)
|
|
||||||
{
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& _os;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// join types
|
|
||||||
static constexpr bool _supports_inner_join = true;
|
|
||||||
static constexpr bool _supports_outer_join = true;
|
|
||||||
static constexpr bool _supports_left_outer_join = true;
|
|
||||||
static constexpr bool _supports_right_outer_join = true;
|
|
||||||
|
|
||||||
// functions
|
|
||||||
static constexpr bool _supports_avg = true;
|
|
||||||
static constexpr bool _supports_count = true;
|
|
||||||
static constexpr bool _supports_exists = true;
|
|
||||||
static constexpr bool _supports_like = true;
|
|
||||||
static constexpr bool _supports_in = true;
|
|
||||||
static constexpr bool _supports_max = true;
|
|
||||||
static constexpr bool _supports_min = true;
|
|
||||||
static constexpr bool _supports_not_in = true;
|
|
||||||
static constexpr bool _supports_sum = true;
|
|
||||||
|
|
||||||
// select
|
|
||||||
static constexpr bool _supports_group_by = true;
|
|
||||||
static constexpr bool _supports_having = true;
|
|
||||||
static constexpr bool _supports_limit = true;
|
|
||||||
static constexpr bool _supports_order_by = true;
|
|
||||||
static constexpr bool _supports_select_as_table = true;
|
|
||||||
|
|
||||||
static constexpr bool _supports_some = true;
|
|
||||||
static constexpr bool _supports_any = true;
|
|
||||||
static constexpr bool _use_concat_operator = true;
|
|
||||||
static constexpr bool _use_concat_function = true;
|
|
||||||
|
|
||||||
const std::string& escape(const std::string& text) { return text; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,7 +87,7 @@ int main()
|
|||||||
|
|
||||||
// Wonderful, now take a look at the parameter list of a select
|
// Wonderful, now take a look at the parameter list of a select
|
||||||
{
|
{
|
||||||
auto s = select(all_of(t)).from(t).where(t.beta.like(where_parameter(t.beta)) and t.alpha == where_parameter(t.alpha) or t.gamma != parameter(t.gamma));
|
auto s = select(all_of(t)).from(t).where(t.beta.like(parameter(t.beta)) and t.alpha == parameter(t.alpha) or t.gamma != parameter(t.gamma));
|
||||||
using S = decltype(s);
|
using S = decltype(s);
|
||||||
using T = sqlpp::make_parameter_list_t<S>::type;
|
using T = sqlpp::make_parameter_list_t<S>::type;
|
||||||
T npl;
|
T npl;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
|
|
||||||
DbMock db;
|
DbMock db;
|
||||||
|
DbMock::_context_t printer(std::cerr);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -56,13 +57,13 @@ int main()
|
|||||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_from(t).serialize(std::cerr, db); std::cerr << "\n";
|
interpret(remove_from(t), printer).flush();
|
||||||
remove_from(t).where(t.beta != "transparent").serialize(std::cerr, db); std::cerr << "\n";
|
interpret(remove_from(t).where(t.beta != "transparent"), printer).flush();
|
||||||
remove_from(t).using_(t).serialize(std::cerr, db); std::cerr << "\n";
|
interpret(remove_from(t).using_(t), printer).flush();
|
||||||
auto r = dynamic_remove_from(db, t).dynamic_using_().dynamic_where();
|
auto r = dynamic_remove_from(db, t).dynamic_using_().dynamic_where();
|
||||||
r = r.add_using_(t);
|
r = r.add_using_(t);
|
||||||
r = r.add_where(t.beta != "transparent");
|
r = r.add_where(t.beta != "transparent");
|
||||||
r.serialize(std::cerr, db); std::cerr << "\n";
|
interpret(r, printer).flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "TabSample.h"
|
#include "TabSample.h"
|
||||||
#include "MockDb.h"
|
#include "MockDb.h"
|
||||||
#include "is_regular.h"
|
#include "is_regular.h"
|
||||||
|
#include <sqlpp11/alias_provider.h>
|
||||||
#include <sqlpp11/select.h>
|
#include <sqlpp11/select.h>
|
||||||
#include <sqlpp11/functions.h>
|
#include <sqlpp11/functions.h>
|
||||||
#include <sqlpp11/connection.h>
|
#include <sqlpp11/connection.h>
|
||||||
@ -33,6 +34,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
DbMock db = {};
|
DbMock db = {};
|
||||||
|
DbMock::_context_t printer(std::cerr);
|
||||||
|
|
||||||
|
namespace alias
|
||||||
|
{
|
||||||
|
SQLPP_ALIAS_PROVIDER(a);
|
||||||
|
SQLPP_ALIAS_PROVIDER(b);
|
||||||
|
SQLPP_ALIAS_PROVIDER(left);
|
||||||
|
SQLPP_ALIAS_PROVIDER(right);
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -59,7 +69,7 @@ int main()
|
|||||||
|
|
||||||
// Test an alias of table
|
// Test an alias of table
|
||||||
{
|
{
|
||||||
using T = decltype(t.as(sqlpp::alias::a));
|
using T = decltype(t.as(alias::a));
|
||||||
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_integral_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_integral_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
|
||||||
@ -77,7 +87,7 @@ int main()
|
|||||||
|
|
||||||
// Test an integral column of an alias of table
|
// Test an integral column of an alias of table
|
||||||
{
|
{
|
||||||
using T = decltype(t.as(sqlpp::alias::a).alpha);
|
using T = decltype(t.as(alias::a).alpha);
|
||||||
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_integral_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_integral_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
|
||||||
@ -132,7 +142,7 @@ int main()
|
|||||||
|
|
||||||
// Test a an alias of a numeric table column
|
// Test a an alias of a numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(t.alpha.as(sqlpp::alias::a));
|
using T = decltype(t.alpha.as(alias::a));
|
||||||
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -180,7 +190,7 @@ int main()
|
|||||||
|
|
||||||
// Test a select of an alias of a single numeric table column
|
// Test a select of an alias of a single numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(select(t.alpha.as(sqlpp::alias::a)).from(t));
|
using T = decltype(select(t.alpha.as(alias::a)).from(t));
|
||||||
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -196,7 +206,7 @@ int main()
|
|||||||
|
|
||||||
// Test an alias of a select of a single numeric table column
|
// Test an alias of a select of a single numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(select(t.alpha).from(t).as(sqlpp::alias::b));
|
using T = decltype(select(t.alpha).from(t).as(alias::b));
|
||||||
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -212,7 +222,7 @@ int main()
|
|||||||
|
|
||||||
// Test the column of an alias of a select of an alias of a single numeric table column
|
// Test the column of an alias of a select of an alias of a single numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(select(t.alpha.as(sqlpp::alias::a)).from(t).as(sqlpp::alias::b));
|
using T = decltype(select(t.alpha.as(alias::a)).from(t).as(alias::b));
|
||||||
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -228,7 +238,7 @@ int main()
|
|||||||
|
|
||||||
// Test the column of an alias of a select of a single numeric table column
|
// Test the column of an alias of a select of a single numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(select(t.alpha).from(t).as(sqlpp::alias::b).alpha);
|
using T = decltype(select(t.alpha).from(t).as(alias::b).alpha);
|
||||||
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -244,7 +254,7 @@ int main()
|
|||||||
|
|
||||||
// Test an alias of a select of an alias of a single numeric table column
|
// Test an alias of a select of an alias of a single numeric table column
|
||||||
{
|
{
|
||||||
using T = decltype(select(t.alpha.as(sqlpp::alias::a)).from(t).as(sqlpp::alias::b).a);
|
using T = decltype(select(t.alpha.as(alias::a)).from(t).as(alias::b).a);
|
||||||
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
|
||||||
@ -269,22 +279,22 @@ int main()
|
|||||||
|
|
||||||
// Test that select(all_of(tab)) is expanded in multi_column
|
// Test that select(all_of(tab)) is expanded in multi_column
|
||||||
{
|
{
|
||||||
auto a = multi_column(sqlpp::alias::a, all_of(t));
|
auto a = multi_column(alias::a, all_of(t));
|
||||||
auto b = multi_column(sqlpp::alias::a, t.alpha, t.beta, t.gamma);
|
auto b = multi_column(alias::a, t.alpha, t.beta, t.gamma);
|
||||||
static_assert(std::is_same<decltype(a), decltype(b)>::value, "all_of(t) has to be expanded by multi_column");
|
static_assert(std::is_same<decltype(a), decltype(b)>::value, "all_of(t) has to be expanded by multi_column");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that select(tab) is expanded in multi_column
|
// Test that select(tab) is expanded in multi_column
|
||||||
{
|
{
|
||||||
auto a = multi_column(sqlpp::alias::a, all_of(t));
|
auto a = multi_column(alias::a, all_of(t));
|
||||||
auto b = multi_column(sqlpp::alias::a, t.alpha, t.beta, t.gamma);
|
auto b = multi_column(alias::a, t.alpha, t.beta, t.gamma);
|
||||||
static_assert(std::is_same<decltype(a), decltype(b)>::value, "t has to be expanded by multi_column");
|
static_assert(std::is_same<decltype(a), decltype(b)>::value, "t has to be expanded by multi_column");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a multicolumn is not a value
|
// Test that a multicolumn is not a value
|
||||||
{
|
{
|
||||||
auto m = multi_column(sqlpp::alias::a, t.alpha, t.beta);
|
auto m = multi_column(alias::a, t.alpha, t.beta);
|
||||||
auto a = select(m).from(t).as(sqlpp::alias::b).a;
|
auto a = select(m).from(t).as(alias::b).a;
|
||||||
static_assert(not sqlpp::is_value_t<decltype(a)>::value, "a multi_column is not a value");
|
static_assert(not sqlpp::is_value_t<decltype(a)>::value, "a multi_column is not a value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +317,7 @@ int main()
|
|||||||
s = s.set_limit(30);
|
s = s.set_limit(30);
|
||||||
s = s.set_limit(3);
|
s = s.set_limit(3);
|
||||||
std::cerr << "------------------------\n";
|
std::cerr << "------------------------\n";
|
||||||
s.serialize(std::cerr, db);
|
interpret(s, printer).flush();
|
||||||
std::cerr << "------------------------\n";
|
std::cerr << "------------------------\n";
|
||||||
using T = decltype(s);
|
using T = decltype(s);
|
||||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||||
@ -316,18 +326,18 @@ int main()
|
|||||||
// Test that select can be called with zero columns if it is used with dynamic columns.
|
// Test that select can be called with zero columns if it is used with dynamic columns.
|
||||||
{
|
{
|
||||||
auto s = dynamic_select(db).dynamic_columns().add_column(t.alpha);
|
auto s = dynamic_select(db).dynamic_columns().add_column(t.alpha);
|
||||||
s.serialize(std::cerr, db); std::cerr << "\n";
|
interpret(s, printer).flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that verbatim_table compiles
|
// Test that verbatim_table compiles
|
||||||
{
|
{
|
||||||
auto s = select(t.alpha).from(sqlpp::verbatim_table("my_unknown_table"));
|
auto s = select(t.alpha).from(sqlpp::verbatim_table("my_unknown_table"));
|
||||||
s.serialize(std::cerr, db); std::cerr << "\n";
|
interpret(s, printer).flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static_assert(sqlpp::is_select_flag_t<decltype(sqlpp::all)>::value, "sqlpp::all has to be a select_flag");
|
static_assert(sqlpp::is_select_flag_t<decltype(sqlpp::all)>::value, "sqlpp::all has to be a select_flag");
|
||||||
using T = sqlpp::detail::wrap_operand<int>::type;
|
using T = sqlpp::vendor::wrap_operand<int>::type;
|
||||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||||
static_assert(T::_is_expression, "T has to be an expression");
|
static_assert(T::_is_expression, "T has to be an expression");
|
||||||
static_assert(std::is_same<typename T::_value_type::_is_numeric, std::true_type>::value, "T has to be a numeric");
|
static_assert(std::is_same<typename T::_value_type::_is_numeric, std::true_type>::value, "T has to be a numeric");
|
||||||
@ -339,29 +349,28 @@ int main()
|
|||||||
auto y = t.gamma and true and t.gamma;
|
auto y = t.gamma and true and t.gamma;
|
||||||
!t.gamma;
|
!t.gamma;
|
||||||
t.beta < "kaesekuchen";
|
t.beta < "kaesekuchen";
|
||||||
(t.beta + "hallenhalma").serialize(std::cerr, db);
|
interpret(t.beta + "hallenhalma", printer).flush();
|
||||||
concat(t.beta, "hallenhalma").serialize(std::cerr, db);
|
|
||||||
static_assert(sqlpp::must_not_insert_t<decltype(t.alpha)>::value, "alpha must not be inserted");
|
static_assert(sqlpp::must_not_insert_t<decltype(t.alpha)>::value, "alpha must not be inserted");
|
||||||
t.alpha.serialize(std::cerr, db);
|
interpret(t.alpha, printer).flush();
|
||||||
std::cerr << "\n" << sizeof(TabSample) << std::endl;
|
std::cerr << "\n" << sizeof(TabSample) << std::endl;
|
||||||
static_assert(std::is_same<typename decltype(t.alpha)::_value_type::_is_named_expression, std::true_type>::value, "alpha should be a named expression");
|
static_assert(std::is_same<typename decltype(t.alpha)::_value_type::_is_named_expression, std::true_type>::value, "alpha should be a named expression");
|
||||||
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha)>::value, "alpha should be a named expression");
|
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha)>::value, "alpha should be a named expression");
|
||||||
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be a named expression");
|
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha.as(alias::a))>::value, "an alias of alpha should be a named expression");
|
||||||
static_assert(sqlpp::is_alias_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be an alias");
|
static_assert(sqlpp::is_alias_t<decltype(t.alpha.as(alias::a))>::value, "an alias of alpha should be an alias");
|
||||||
auto z = select(t.alpha) == 7;
|
auto z = select(t.alpha) == 7;
|
||||||
auto l = t.as(sqlpp::alias::left);
|
auto l = t.as(alias::left);
|
||||||
auto r = select(t.gamma.as(sqlpp::alias::a)).from(t).where(t.gamma == true).as(sqlpp::alias::right);
|
auto r = select(t.gamma.as(alias::a)).from(t).where(t.gamma == true).as(alias::right);
|
||||||
static_assert(sqlpp::is_boolean_t<decltype(select(t.gamma).from(t))>::value, "select(bool) has to be a bool");
|
static_assert(sqlpp::is_boolean_t<decltype(select(t.gamma).from(t))>::value, "select(bool) has to be a bool");
|
||||||
select(sqlpp::distinct, sqlpp::straight_join, l.alpha, l.beta, select(r.a).from(r))
|
interpret(select(sqlpp::distinct, sqlpp::straight_join, l.alpha, l.beta, select(r.a).from(r))
|
||||||
.from(l, r)
|
.from(l, r)
|
||||||
.where(t.beta == "hello world" and select(t.gamma).from(t))// .as(sqlpp::alias::right))
|
.where(t.beta == "hello world" and select(t.gamma).from(t))// .as(alias::right))
|
||||||
.group_by(l.gamma, r.a)
|
.group_by(l.gamma, r.a)
|
||||||
.having(r.a != true)
|
.having(r.a != true)
|
||||||
.order_by(l.beta.asc())
|
.order_by(l.beta.asc())
|
||||||
.limit(17)
|
.limit(17)
|
||||||
.offset(3)
|
.offset(3)
|
||||||
.as(sqlpp::alias::a)
|
.as(alias::a)
|
||||||
.serialize(std::cerr, db);
|
, printer).flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "is_regular.h"
|
#include "is_regular.h"
|
||||||
|
|
||||||
DbMock db;
|
DbMock db;
|
||||||
|
DbMock::_context_t printer(std::cerr);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -54,12 +55,12 @@ int main()
|
|||||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||||
}
|
}
|
||||||
|
|
||||||
update(t).serialize(std::cerr, db); std::cerr << "\n";
|
interpret(update(t), printer).flush();
|
||||||
update(t).set(t.gamma = false).serialize(std::cerr, db); std::cerr << "\n";
|
interpret(update(t).set(t.gamma = false), printer).flush();
|
||||||
update(t).set(t.gamma = false).where(t.beta != "transparent").serialize(std::cerr, db); std::cerr << "\n";
|
interpret(update(t).set(t.gamma = false).where(t.beta != "transparent"), printer).flush();
|
||||||
auto u = dynamic_update(db, t).dynamic_set(t.gamma = false).dynamic_where();
|
auto u = dynamic_update(db, t).dynamic_set(t.gamma = false).dynamic_where();
|
||||||
u = u.add_set(t.gamma = false);
|
u = u.add_set(t.gamma = false);
|
||||||
u.serialize(std::cerr, db); std::cerr << "\n";
|
interpret(u, printer).flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user