mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-10 07:02:11 -06:00
Merge branch 'feature/appveyor' into develop
This commit is contained in:
27
.appveyor.yml
Normal file
27
.appveyor.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
os: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
build_script:
|
||||
- CD
|
||||
- cd ..
|
||||
- CD
|
||||
- git clone https://github.com/HowardHinnant/date
|
||||
- cd sqlpp11
|
||||
- CD
|
||||
- echo %configuration%
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake --version
|
||||
- cmake .. -DCMAKE_CXX_FLAGS="/EHsc /wd4503"
|
||||
- cmake --build . --config %configuration%
|
||||
- ctest . --build-config %configuration%
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
#include "MockDb.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
|
||||
int insert(int, char**)
|
||||
int insert(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb db{};
|
||||
|
||||
test::TabPerson p;
|
||||
test::TabFeature f;
|
||||
const auto p = test::TabPerson{};
|
||||
const auto f = test::TabFeature{};
|
||||
|
||||
db(insert_into(f).set(f.name = "loves c++", f.fatal = false));
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ SQLPP_DECLARE_TABLE(
|
||||
)
|
||||
// clang-format on
|
||||
|
||||
int ppgen(int, char**)
|
||||
int ppgen(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
tab_person::tab_person p;
|
||||
tab_feature::tab_feature f;
|
||||
MockDb db{};
|
||||
const auto p = tab_person::tab_person{};
|
||||
const auto f = tab_feature::tab_feature{};
|
||||
|
||||
db(insert_into(f).set(f.name = "loves c++", f.fatal = false));
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
#include "MockDb.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
|
||||
int remove(int, char**)
|
||||
int remove(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb db{};
|
||||
|
||||
test::TabPerson p;
|
||||
test::TabFeature q;
|
||||
const auto p = test::TabPerson{};
|
||||
const auto q = test::TabFeature{};
|
||||
|
||||
db(remove_from(p).using_(p, q).where(p.feature == q.id and q.fatal == true));
|
||||
return 0;
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
MockDb db;
|
||||
MockDb db{};
|
||||
|
||||
test::TabPerson p;
|
||||
test::TabFeature f;
|
||||
const auto p = test::TabPerson{};
|
||||
const auto f = test::TabFeature{};
|
||||
|
||||
db(insert_into(f).set(f.name = "Loves C++", p.fatal = false));
|
||||
|
||||
|
||||
@@ -36,15 +36,17 @@
|
||||
|
||||
SQLPP_ALIAS_PROVIDER(cheesecake)
|
||||
|
||||
int select(int, char**)
|
||||
int select(int, char*[])
|
||||
{
|
||||
static constexpr bool some_condition = true;
|
||||
static constexpr bool some_other_condition = false;
|
||||
|
||||
MockDb db;
|
||||
MockDb db{};
|
||||
|
||||
test::TabPerson p;
|
||||
test::TabFeature f;
|
||||
const auto p = test::TabPerson{};
|
||||
#if 0
|
||||
const auto f = test::TabFeature{};
|
||||
#endif
|
||||
|
||||
for (const auto& row : db(select(all_of(p)).from(p).where(p.id > 7)))
|
||||
{
|
||||
|
||||
@@ -27,12 +27,11 @@
|
||||
#include "MockDb.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
|
||||
int update(int, char**)
|
||||
int update(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb db{};
|
||||
|
||||
test::TabPerson p;
|
||||
// test::TabFeature q;
|
||||
const auto p = test::TabPerson{};
|
||||
|
||||
db(update(p).set(p.feature = 7).where(p.id == 23));
|
||||
return 0;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <sqlpp11/result_field.h>
|
||||
#include <sqlpp11/exception.h>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/bad_statement.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
@@ -115,7 +116,9 @@ namespace sqlpp
|
||||
return _value;
|
||||
}
|
||||
|
||||
operator _cpp_value_type() const
|
||||
operator typename std::conditional<_null_is_trivial or (not _can_be_null::value),
|
||||
_cpp_value_type,
|
||||
bad_statement>::type() const
|
||||
{
|
||||
return value();
|
||||
}
|
||||
|
||||
@@ -226,12 +226,25 @@ namespace sqlpp
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_dynamic_statement_dynamic_t,
|
||||
"dynamic_where() must not be called in a static statement");
|
||||
|
||||
// workaround for msvc bugs https://connect.microsoft.com/VisualStudio/Feedback/Details/2086629 & https://connect.microsoft.com/VisualStudio/feedback/details/2173198
|
||||
// template <typename... Expressions>
|
||||
// using check_where_t = static_combined_check_t<
|
||||
// static_check_t<logic::all_t<is_expression_t<Expressions>::value...>::value, assert_where_expressions_t>,
|
||||
// static_check_t<logic::all_t<is_boolean_t<Expressions>::value...>::value, assert_where_boolean_t>,
|
||||
// static_check_t<logic::all_t<(not contains_aggregate_function_t<Expressions>::value)...>::value,
|
||||
// assert_where_no_aggregate_functions_t>>;
|
||||
template <typename... Expressions>
|
||||
using check_where_t = static_combined_check_t<
|
||||
static_check_t<logic::all_t<is_expression_t<Expressions>::value...>::value, assert_where_expressions_t>,
|
||||
static_check_t<logic::all_t<is_boolean_t<Expressions>::value...>::value, assert_where_boolean_t>,
|
||||
static_check_t<logic::all_t<(not contains_aggregate_function_t<Expressions>::value)...>::value,
|
||||
assert_where_no_aggregate_functions_t>>;
|
||||
struct check_where
|
||||
{
|
||||
using type = static_combined_check_t<
|
||||
static_check_t<logic::all_t<detail::is_expression_impl<Expressions>::type::value...>::value, assert_where_expressions_t>,
|
||||
static_check_t<logic::all_t<is_boolean_t<Expressions>::value...>::value, assert_where_boolean_t>,
|
||||
static_check_t<logic::all_t<(not detail::contains_aggregate_function_impl<Expressions>::type::value)...>::value,
|
||||
assert_where_no_aggregate_functions_t>>;
|
||||
};
|
||||
|
||||
template <typename... Expressions>
|
||||
using check_where_t = typename check_where<Expressions...>::type;
|
||||
|
||||
template <typename... Expressions>
|
||||
using check_where_static_t =
|
||||
|
||||
@@ -35,7 +35,7 @@ endfunction()
|
||||
|
||||
test_constraint(count_of_count "count\\(\\) cannot be used on an aggregate function")
|
||||
test_constraint(max_of_max "max\\(\\) cannot be used on an aggregate function")
|
||||
test_constraint(no_conversion_operator_if_null_not_trivial "int i = row.alpha")
|
||||
test_constraint(no_conversion_operator_if_null_not_trivial "cannot convert|no viable conversion")
|
||||
test_constraint(require_insert "required column is missing")
|
||||
test_constraint(must_not_insert "one assignment is prohibited")
|
||||
test_constraint(must_not_update "one assignment is prohibited")
|
||||
|
||||
@@ -32,7 +32,7 @@ MockDb db;
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
count(count(t.alpha));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ MockDb db;
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
max(max(t.alpha));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ MockDb db;
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
insert_into(t).set(t.alpha = 7, t.gamma = false, t.beta = "alpha must not be set");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ MockDb db;
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
update(t).set(t.alpha = 7, t.gamma = false, t.beta = "alpha must not be set");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ EnforceDb edb{};
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
static_assert(sqlpp::can_be_null_t<decltype(t.alpha)>::value, "t.alpha can be null");
|
||||
static_assert(not sqlpp::null_is_trivial_value_t<decltype(t.alpha)>::value, "t.alpha does not say null_is_trivial");
|
||||
|
||||
@@ -32,7 +32,7 @@ MockDb db;
|
||||
|
||||
int main()
|
||||
{
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
insert_into(t).set(t.beta = "need also to insert gamma");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
no_group_by();
|
||||
dynamic_group_by();
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
when();
|
||||
then();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
allowed_comparands();
|
||||
disallowed_comparands();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
allowed_comparands();
|
||||
disallowed_comparands();
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
static_set();
|
||||
dynamic_set();
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char*[])
|
||||
{
|
||||
static_where();
|
||||
dynamic_where();
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#include "MockDb.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
|
||||
int BooleanExpression(int, char**)
|
||||
int BooleanExpression(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
auto x = boolean_expression(db, not(t.alpha == 7));
|
||||
x = sqlpp::boolean_expression<MockDb>(t.beta.like("%cheesecake"));
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
#include <sqlpp11/custom_query.h>
|
||||
|
||||
int CustomQuery(int, char**)
|
||||
int CustomQuery(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabFoo f;
|
||||
test::TabBar t;
|
||||
const auto f = test::TabFoo{};
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
// A void custom query
|
||||
printer.reset();
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
SQLPP_ALIAS_PROVIDER(now)
|
||||
|
||||
int DateTime(int, char**)
|
||||
int DateTime(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer;
|
||||
test::TabDateTime t;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
const auto t = test::TabDateTime{};
|
||||
|
||||
for (const auto& row : db(select(::sqlpp::value(std::chrono::system_clock::now()).as(now))))
|
||||
{
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
SQLPP_ALIAS_PROVIDER(kaesekuchen)
|
||||
|
||||
int Function(int, char**)
|
||||
int Function(int, char* [])
|
||||
{
|
||||
MockDb db = {};
|
||||
test::TabFoo f;
|
||||
test::TabBar t;
|
||||
const auto f = test::TabFoo{};
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
// f.omega + 4 *= "";
|
||||
|
||||
@@ -286,7 +286,7 @@ int Function(int, char**)
|
||||
static_assert(sqlpp::is_integral_t<TT>::value, "type requirement");
|
||||
static_assert(not sqlpp::is_floating_point_t<TT>::value, "type requirement");
|
||||
|
||||
if (false and db(select(count(t.alpha)).from(t).where(true)).front().count)
|
||||
if (false and db(select(count(t.alpha)).from(t).where(true)).front().count > 0)
|
||||
{ /* do something */
|
||||
}
|
||||
}
|
||||
@@ -446,11 +446,14 @@ int Function(int, char**)
|
||||
|
||||
for (const auto& row : db(select(all_of(t)).from(t).where(true)))
|
||||
{
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.alpha)), sqlpp::tvin_arg_t<decltype(row.alpha)>>::value,
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.alpha)),
|
||||
sqlpp::tvin_arg_t<typename std::remove_const<decltype(row.alpha)>::type>>::value,
|
||||
"result fields are accepted and not wrapped");
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.beta)), sqlpp::tvin_arg_t<decltype(row.beta)>>::value,
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.beta)),
|
||||
sqlpp::tvin_arg_t<typename std::remove_const<decltype(row.beta)>::type>>::value,
|
||||
"result fields are accepted and not wrapped");
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.gamma)), sqlpp::tvin_arg_t<decltype(row.gamma)>>::value,
|
||||
static_assert(std::is_same<decltype(sqlpp::tvin(row.gamma)),
|
||||
sqlpp::tvin_arg_t<typename std::remove_const<decltype(row.gamma)>::type>>::value,
|
||||
"result fields are accepted and not wrapped");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#include <sqlpp11/functions.h>
|
||||
#include <iostream>
|
||||
|
||||
int Insert(int, char**)
|
||||
int Insert(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb::_serializer_context_t printer;
|
||||
test::TabBar t;
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
const auto t = test::TabBar{};
|
||||
// test::TabFoo f;
|
||||
|
||||
{
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int Interpret(int, char**)
|
||||
int Interpret(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabFoo f;
|
||||
test::TabBar t;
|
||||
const auto f = test::TabFoo{};
|
||||
const auto t = test::TabBar{};
|
||||
select(t.alpha.as(t.beta));
|
||||
|
||||
serialize(insert_into(t).columns(t.beta, t.gamma), printer).str();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
|
||||
int Minimalistic(int, char**)
|
||||
int Minimalistic(int, char*[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#include <sqlpp11/functions.h>
|
||||
#include <sqlpp11/select.h>
|
||||
|
||||
int Prepared(int, char**)
|
||||
int Prepared(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
// test::TabFoo f;
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
// empty parameter lists
|
||||
{
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
#include "MockDb.h"
|
||||
#include "is_regular.h"
|
||||
|
||||
int Remove(int, char**)
|
||||
int Remove(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
{
|
||||
using T = decltype(remove_from(t));
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
static_assert(not sqlpp::enforce_null_result_treatment_t<MockDb>::value, "MockDb interprets NULL as trivial");
|
||||
static_assert(sqlpp::enforce_null_result_treatment_t<EnforceDb>::value, "MockDb does not interpret NULL as trivial");
|
||||
|
||||
int Result(int, char**)
|
||||
int Result(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
EnforceDb edb{};
|
||||
|
||||
test::TabBar t;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
static_assert(sqlpp::can_be_null_t<decltype(t.alpha)>::value, "t.alpha can be null");
|
||||
static_assert(not sqlpp::null_is_trivial_value_t<decltype(t.alpha)>::value, "t.alpha does not say null_is_trivial");
|
||||
|
||||
@@ -42,13 +42,13 @@ int64_t getColumn(Db&& db, const Column& column)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Select(int, char**)
|
||||
int Select(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabFoo f;
|
||||
test::TabBar t;
|
||||
const auto f = test::TabFoo{};
|
||||
const auto t = test::TabBar{};
|
||||
const auto tab_a = f.as(sqlpp::alias::a);
|
||||
|
||||
getColumn(db, t.alpha);
|
||||
|
||||
@@ -40,17 +40,17 @@ namespace alias
|
||||
SQLPP_ALIAS_PROVIDER(right)
|
||||
}
|
||||
|
||||
int SelectType(int, char**)
|
||||
int SelectType(int, char*[])
|
||||
{
|
||||
MockDb db = {};
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabFoo f;
|
||||
test::TabBar t;
|
||||
auto f = test::TabFoo{};
|
||||
auto t = test::TabBar{};
|
||||
|
||||
// Test a table
|
||||
{
|
||||
using T = decltype(t);
|
||||
using T = typename std::decay<decltype(t)>::type;
|
||||
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_floating_point_t<T>::value, "type requirement");
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <sqlpp11/alias_provider.h>
|
||||
#include <iostream>
|
||||
|
||||
int Union(int, char**)
|
||||
int Union(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabBar t;
|
||||
test::TabFoo f;
|
||||
const auto t = test::TabBar{};
|
||||
const auto f = test::TabFoo{};
|
||||
|
||||
db(select(t.alpha).from(t).where(true).union_distinct(select(f.epsilon.as(t.alpha)).from(f).where(true)));
|
||||
db(select(t.alpha).from(t).where(true).union_all(select(f.epsilon.as(t.alpha)).from(f).where(true)));
|
||||
|
||||
@@ -29,13 +29,12 @@
|
||||
#include "MockDb.h"
|
||||
#include "is_regular.h"
|
||||
|
||||
int Update(int, char**)
|
||||
int Update(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
test::TabBar t;
|
||||
// test::TabFoo f;
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
{
|
||||
using T = decltype(update(t));
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
#include <sqlpp11/alias_provider.h>
|
||||
#include <iostream>
|
||||
|
||||
int With(int, char**)
|
||||
int With(int, char*[])
|
||||
{
|
||||
MockDb db;
|
||||
MockDb::_serializer_context_t printer;
|
||||
MockDb::_serializer_context_t printer = {};
|
||||
|
||||
const auto t = test::TabBar{};
|
||||
|
||||
|
||||
@@ -45,14 +45,16 @@ namespace sqlpp
|
||||
|
||||
static constexpr bool value =
|
||||
true
|
||||
#if !defined _MSC_VER
|
||||
#if defined SQLPP_TEST_NO_THROW_MOVE_CONSTRUCTIBLE
|
||||
and std::is_nothrow_move_constructible<T>::value
|
||||
#endif
|
||||
and std::is_move_assignable<T>::value // containers and strings are not noexcept_assignable
|
||||
and std::is_copy_constructible<T>::value and std::is_copy_assignable<T>::value
|
||||
// default constructor makes no sense
|
||||
// (not) equals would be possible
|
||||
// not sure about less
|
||||
// default constructor makes no sense
|
||||
// (not) equals would be possible
|
||||
// not sure about less
|
||||
#endif
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user