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: 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; 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>> { 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