From 7422cb9e3b45389529b5c067250f596dddc9a72f Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 25 Jun 2017 10:02:41 +0200 Subject: [PATCH 1/2] Compile with both, MSVC 2015 and 2017 Make MSVC 2017 accept the code as well MSVC still has problems with variadic templates... Adjust README, do not do debug build (reduce load for appveyor) --- .appveyor.yml | 6 ++++-- README.md | 2 +- include/sqlpp11/having.h | 8 +++++++- include/sqlpp11/statement.h | 15 ++++++++++----- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ba2387cf..adadfdb7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,10 +1,12 @@ -os: Visual Studio 2015 +os: + - Visual Studio 2015 + - Visual Studio 2017 platform: - x64 configuration: - - Debug + #- Debug - Release matrix: diff --git a/README.md b/README.md index d06ae11e..48839d43 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ See [Changes](ChangeLog.md) Status: ------- -Branch / Compiler | clang-3.4, gcc-4.9, Xcode-7 | MSVC 2015 | Test Coverage +Branch / Compiler | clang-3.4, gcc-4.9, Xcode-7 | MSVC 2015/2017 | Test Coverage ------------------| -------------------------------|-------------|--------------- master | [![Build Status](https://travis-ci.org/rbock/sqlpp11.svg?branch=master)](https://travis-ci.org/rbock/sqlpp11?branch=master) | [![Build status](https://ci.appveyor.com/api/projects/status/eid7mwqgavo0h61h/branch/master?svg=true)](https://ci.appveyor.com/project/rbock/sqlpp11/branch/master) | [![Coverage Status](https://coveralls.io/repos/rbock/sqlpp11/badge.svg?branch=master)](https://coveralls.io/r/rbock/sqlpp11?branch=master) develop | [![Build Status](https://travis-ci.org/rbock/sqlpp11.svg?branch=develop)](https://travis-ci.org/rbock/sqlpp11?branch=develop) | [![Build status](https://ci.appveyor.com/api/projects/status/eid7mwqgavo0h61h/branch/develop?svg=true)](https://ci.appveyor.com/project/rbock/sqlpp11/branch/develop) | [![Coverage Status](https://coveralls.io/repos/rbock/sqlpp11/badge.svg?branch=develop)](https://coveralls.io/r/rbock/sqlpp11?branch=develop) diff --git a/include/sqlpp11/having.h b/include/sqlpp11/having.h index a5fcfa6c..d2cd2e8b 100644 --- a/include/sqlpp11/having.h +++ b/include/sqlpp11/having.h @@ -181,6 +181,12 @@ namespace sqlpp static_check_t::value, assert_having_dynamic_statement_dynamic_t>, check_having_t>; + template + constexpr auto are_all_parameters_expressions() -> bool + { + return logic::all_t::value...>::value; + } + // NO HAVING YET struct no_having_t { @@ -237,7 +243,7 @@ namespace sqlpp // template // using _check = logic::all_t::value...>; template - struct _check : logic::all_t::value...> + struct _check : std::integral_constant()> { }; diff --git a/include/sqlpp11/statement.h b/include/sqlpp11/statement.h index 34af1dcc..f3fccf49 100644 --- a/include/sqlpp11/statement.h +++ b/include/sqlpp11/statement.h @@ -54,6 +54,12 @@ namespace sqlpp namespace detail { + template + constexpr auto is_any_policy_missing() -> bool + { + return logic::any_t::value...>::value; + } + template struct statement_policies_t { @@ -122,11 +128,10 @@ namespace sqlpp } using _value_type = - typename std::conditional::value...>::value, - value_type_of<_result_type_provider>, - no_value_t // if a required statement part is missing (e.g. columns in a select), - // then the statement cannot be used as a value - >::type; + typename std::conditional(), + no_value_t, // if a required statement part is missing (e.g. columns in a select), + // then the statement cannot be used as a value + value_type_of<_result_type_provider>>::type; using _traits = make_traits<_value_type, tag_if::value>>; From 64498654b7b4ef3c747082c0d9e1c1a6ca21fc97 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 25 Jun 2017 13:01:43 +0200 Subject: [PATCH 2/2] Fixed some clang warnings --- include/sqlpp11/for_update.h | 2 +- test_serializer/ForUpdate.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/sqlpp11/for_update.h b/include/sqlpp11/for_update.h index 4d84f9b6..0ee3471a 100644 --- a/include/sqlpp11/for_update.h +++ b/include/sqlpp11/for_update.h @@ -162,7 +162,7 @@ namespace sqlpp using _serialize_check = serialize_check_of; using T = for_update_data_t; - static Context& _(const T& t, Context& context) + static Context& _(const T&, Context& context) { context << " FOR UPDATE "; return context; diff --git a/test_serializer/ForUpdate.cpp b/test_serializer/ForUpdate.cpp index 3d57fe43..02bb5c9e 100644 --- a/test_serializer/ForUpdate.cpp +++ b/test_serializer/ForUpdate.cpp @@ -31,11 +31,13 @@ namespace { + /* auto getTrue() -> std::string { MockDb::_serializer_context_t printer = {}; return serialize(sqlpp::value(true), printer).str(); } + */ auto getFalse() -> std::string { @@ -47,14 +49,14 @@ namespace int ForUpdate(int, char* []) { const auto foo = test::TabFoo{}; - const auto bar = test::TabBar{}; + // const auto bar = test::TabBar{}; // Unconditionally - compare(__LINE__, select(foo.omega).from(foo).unconditionally().for_update(), "SELECT tab_foo.omega FROM tab_foo FOR UPDATE "); + compare(__LINE__, select(foo.omega).from(foo).unconditionally().for_update(), + "SELECT tab_foo.omega FROM tab_foo FOR UPDATE "); // Never compare(__LINE__, where(sqlpp::value(false)), " WHERE " + getFalse()); - return 0; }