From 14ae288f312f9eb7d4711204fd066a0e9624b679 Mon Sep 17 00:00:00 2001 From: Rustam Abdullaev Date: Mon, 25 Jun 2018 15:16:17 +0200 Subject: [PATCH 1/4] Remove "MSVC 2017 is currently broken" message --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index dc8c040c..6f7b64d3 100644 --- a/README.md +++ b/README.md @@ -93,10 +93,6 @@ Branch / Compiler | clang-3.4, gcc-4.9, Xcode-7 | MSVC 2015/2017 | Test Cov 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) -MSVC 2017 is currently broken, see - - https://github.com/rbock/sqlpp11/issues/181 - - https://developercommunity.visualstudio.com/content/problem/95983/c-vs152-153-regression-in-variadic-template-argume.html - Additional information available: --------------------------------- Past talks about sqlpp11 and some coding concepts used within the library: From ef01958b195e9a8ad7b77780fc53e14fbb8c8bf2 Mon Sep 17 00:00:00 2001 From: rbock Date: Tue, 26 Jun 2018 08:07:08 +0200 Subject: [PATCH 2/4] Add comments to code that is required to not compile --- test_constraints/CMakeLists.txt | 1 + test_constraints/count_of_count.cpp | 5 +++++ test_constraints/max_of_max.cpp | 5 +++++ test_constraints/must_not_insert.cpp | 5 +++++ test_constraints/must_not_update.cpp | 5 +++++ .../no_conversion_operator_if_null_not_trivial.cpp | 5 +++++ test_constraints/require_insert.cpp | 5 +++++ 7 files changed, 31 insertions(+) diff --git a/test_constraints/CMakeLists.txt b/test_constraints/CMakeLists.txt index c2784d14..1bfda1ed 100644 --- a/test_constraints/CMakeLists.txt +++ b/test_constraints/CMakeLists.txt @@ -33,6 +33,7 @@ function(test_constraint name pattern) set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern}) endfunction() +# Compiling these is required to fail (testing some static_assert) 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 "cannot convert|no viable conversion") diff --git a/test_constraints/count_of_count.cpp b/test_constraints/count_of_count.cpp index 4c480360..bf74712d 100644 --- a/test_constraints/count_of_count.cpp +++ b/test_constraints/count_of_count.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test a static_assert) + */ + #include "Sample.h" #include "MockDb.h" #include diff --git a/test_constraints/max_of_max.cpp b/test_constraints/max_of_max.cpp index 8fb5a363..3d7e314a 100644 --- a/test_constraints/max_of_max.cpp +++ b/test_constraints/max_of_max.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test a static_assert) + */ + #include "Sample.h" #include "MockDb.h" #include diff --git a/test_constraints/must_not_insert.cpp b/test_constraints/must_not_insert.cpp index c3c3249f..8b3e9036 100644 --- a/test_constraints/must_not_insert.cpp +++ b/test_constraints/must_not_insert.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test a static_assert) + */ + #include "Sample.h" #include "MockDb.h" #include diff --git a/test_constraints/must_not_update.cpp b/test_constraints/must_not_update.cpp index d24daa1c..0cfd860a 100644 --- a/test_constraints/must_not_update.cpp +++ b/test_constraints/must_not_update.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test a static_assert) + */ + #include "Sample.h" #include "MockDb.h" #include diff --git a/test_constraints/no_conversion_operator_if_null_not_trivial.cpp b/test_constraints/no_conversion_operator_if_null_not_trivial.cpp index a74400f3..bd4934df 100644 --- a/test_constraints/no_conversion_operator_if_null_not_trivial.cpp +++ b/test_constraints/no_conversion_operator_if_null_not_trivial.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test the absence of a conversion operator) + */ + #include "Sample.h" #include "MockDb.h" #include diff --git a/test_constraints/require_insert.cpp b/test_constraints/require_insert.cpp index 0ab7fc7b..a8518876 100644 --- a/test_constraints/require_insert.cpp +++ b/test_constraints/require_insert.cpp @@ -23,6 +23,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * NOTE: + * This code must not compile (it is used to test a static_assert) + */ + #include "Sample.h" #include "MockDb.h" #include From 8d05e4e05eed319c8e61baf3d0c48defe7786e93 Mon Sep 17 00:00:00 2001 From: rbock Date: Thu, 28 Jun 2018 19:20:09 +0200 Subject: [PATCH 3/4] Add serializer for value_or_null --- include/sqlpp11/value_or_null.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/sqlpp11/value_or_null.h b/include/sqlpp11/value_or_null.h index 0643d5ad..788f1899 100644 --- a/include/sqlpp11/value_or_null.h +++ b/include/sqlpp11/value_or_null.h @@ -52,6 +52,27 @@ namespace sqlpp bool _is_null; }; + template + struct serializer_t> + { + using _serialize_check = consistent_t; + using Operand = value_or_null_t; + + static Context& _(const Operand& t, Context& context) + { + if (t._is_null) + { + context << "NULL"; + } + else + { + serialize(wrap_operand_t{t._value}, context); + } + + return context; + } + }; + template auto value_or_null(T t) -> value_or_null_t>> { From 6a45d058de2b7d05d208a9556c10fd2580a5cdeb Mon Sep 17 00:00:00 2001 From: Dirk Vanden Boer Date: Thu, 5 Jul 2018 21:45:14 +0200 Subject: [PATCH 4/4] Fixed transaction_t move constructor --- include/sqlpp11/transaction.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/sqlpp11/transaction.h b/include/sqlpp11/transaction.h index a27ebaee..353b461e 100644 --- a/include/sqlpp11/transaction.h +++ b/include/sqlpp11/transaction.h @@ -66,7 +66,12 @@ namespace sqlpp } transaction_t(const transaction_t&) = delete; - transaction_t(transaction_t&&) = default; + transaction_t(transaction_t&& other) + : _db(other._db), _report_unfinished_transaction(other._report_unfinished_transaction), _finished(other._finished) + { + other._finished = true; + } + transaction_t& operator=(const transaction_t&) = delete; transaction_t& operator=(transaction_t&&) = delete;