0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Added serialization to MockDb run methods

Implicitly increased number of serialization tests.
Fixed serialization for logical_not
This commit is contained in:
rbock 2014-08-04 18:24:51 +02:00
parent cc512d0955
commit c9372eff89
2 changed files with 20 additions and 3 deletions

View File

@ -165,7 +165,7 @@ namespace sqlpp
context << "("; context << "(";
if (trivial_value_is_null_t<Rhs>::value) if (trivial_value_is_null_t<Rhs>::value)
{ {
serialize(t._lhs, context); serialize(t._rhs, context);
context << " IS NULL "; context << " IS NULL ";
} }
else else
@ -174,6 +174,8 @@ namespace sqlpp
serialize(t._rhs, context); serialize(t._rhs, context);
} }
context << ")"; context << ")";
return context;
} }
}; };

View File

@ -30,7 +30,6 @@
#include <sqlpp11/serializer_context.h> #include <sqlpp11/serializer_context.h>
#include <sqlpp11/connection.h> #include <sqlpp11/connection.h>
#warning add serialization to run methods to increase the number of tests
template<bool enforceNullResultTreatment> template<bool enforceNullResultTreatment>
struct MockDbT: public sqlpp::connection struct MockDbT: public sqlpp::connection
{ {
@ -105,24 +104,32 @@ struct MockDbT: public sqlpp::connection
template<typename Insert> template<typename Insert>
size_t insert(const Insert& x) size_t insert(const Insert& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return 0; return 0;
} }
template<typename Update> template<typename Update>
size_t update(const Update& x) size_t update(const Update& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return 0; return 0;
} }
template<typename Remove> template<typename Remove>
size_t remove(const Remove& x) size_t remove(const Remove& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return 0; return 0;
} }
template<typename Select> template<typename Select>
result_t select(const Select& s) result_t select(const Select& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return {}; return {};
} }
@ -139,24 +146,32 @@ struct MockDbT: public sqlpp::connection
template<typename Insert> template<typename Insert>
_prepared_statement_t prepare_insert(Insert& x) _prepared_statement_t prepare_insert(Insert& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return nullptr; return nullptr;
} }
template<typename PreparedInsert> template<typename PreparedInsert>
size_t run_prepared_insert(const PreparedInsert& x) size_t run_prepared_insert(const PreparedInsert& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return 0; return 0;
} }
template<typename Select> template<typename Select>
_prepared_statement_t prepare_select(Select& x) _prepared_statement_t prepare_select(Select& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return nullptr; return nullptr;
} }
template<typename PreparedSelect> template<typename PreparedSelect>
result_t run_prepared_select(PreparedSelect& x) result_t run_prepared_select(PreparedSelect& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return {}; return {};
} }