diff options
-rw-r--r-- | libdbpp/command.h | 7 | ||||
-rw-r--r-- | libdbpp/unittests/testUtils.cpp | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libdbpp/command.h b/libdbpp/command.h index 8fbff4e..d9bc853 100644 --- a/libdbpp/command.h +++ b/libdbpp/command.h @@ -65,7 +65,12 @@ namespace DB { #define OPTWRAPPER(func) \ template<typename O> \ - inline typename std::enable_if<std::is_constructible<bool, const O &>::value>::type func(unsigned int i, const O & o) { \ + inline auto \ + func(unsigned int i, const O & o) -> typename std::enable_if< \ + std::is_constructible<bool, const O &>::value \ + && !std::is_void<decltype(*o)>::value \ + >::type\ + { \ bool nn(o); \ if (nn) \ func(i, *o); \ diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp index cb660cc..1435ad3 100644 --- a/libdbpp/unittests/testUtils.cpp +++ b/libdbpp/unittests/testUtils.cpp @@ -219,6 +219,15 @@ BOOST_AUTO_TEST_CASE( charStarBindNull ) } } +BOOST_AUTO_TEST_CASE( bind ) +{ + auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock")); + auto m = db->modify("doesn't matter, only testing compile"); + m->bindParamI(0, (unsigned char)1); + m->bindParamI(0, (char)1); + m->bindParamI(0, (time_t)1); +} + BOOST_AUTO_TEST_CASE( bindIntPtr ) { auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock")); |