From c9372eff8959c4f6fb5981d801099a2b5009dfa4 Mon Sep 17 00:00:00 2001 From: rbock Date: Mon, 4 Aug 2014 18:24:51 +0200 Subject: [PATCH] Added serialization to MockDb run methods Implicitly increased number of serialization tests. Fixed serialization for logical_not --- include/sqlpp11/expression.h | 4 +++- tests/MockDb.h | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/sqlpp11/expression.h b/include/sqlpp11/expression.h index 22c6c92b..73b6c3a8 100644 --- a/include/sqlpp11/expression.h +++ b/include/sqlpp11/expression.h @@ -165,7 +165,7 @@ namespace sqlpp context << "("; if (trivial_value_is_null_t::value) { - serialize(t._lhs, context); + serialize(t._rhs, context); context << " IS NULL "; } else @@ -174,6 +174,8 @@ namespace sqlpp serialize(t._rhs, context); } context << ")"; + + return context; } }; diff --git a/tests/MockDb.h b/tests/MockDb.h index 3356c214..64cbb883 100644 --- a/tests/MockDb.h +++ b/tests/MockDb.h @@ -30,7 +30,6 @@ #include #include -#warning add serialization to run methods to increase the number of tests template struct MockDbT: public sqlpp::connection { @@ -105,24 +104,32 @@ struct MockDbT: public sqlpp::connection template size_t insert(const Insert& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return 0; } template size_t update(const Update& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return 0; } template size_t remove(const Remove& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return 0; } template - result_t select(const Select& s) + result_t select(const Select& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return {}; } @@ -139,24 +146,32 @@ struct MockDbT: public sqlpp::connection template _prepared_statement_t prepare_insert(Insert& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return nullptr; } template size_t run_prepared_insert(const PreparedInsert& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return 0; } template _prepared_statement_t prepare_select(Select& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return nullptr; } template result_t run_prepared_select(PreparedSelect& x) { + _serializer_context_t context; + ::sqlpp::serialize(x, context); return {}; }