diff options
Diffstat (limited to 'common/blob/test.hxx')
-rw-r--r-- | common/blob/test.hxx | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/common/blob/test.hxx b/common/blob/test.hxx index 9e6434b..5d88d8b 100644 --- a/common/blob/test.hxx +++ b/common/blob/test.hxx @@ -5,17 +5,25 @@ #ifndef TEST_HXX #define TEST_HXX +#include <common/config.hxx> // HAVE_CXX11 + #include <vector> #include <cstring> // std::memcmp +#ifdef HAVE_CXX11 +# include <array> +#endif + #include <odb/core.hxx> #ifdef ODB_COMPILER # if defined(ODB_DATABASE_PGSQL) # define BLOB_TYPE "BYTEA" # elif defined(ODB_DATABASE_MSSQL) +//# define BLOB_TYPE "VARBINARY(1024)" # define BLOB_TYPE "VARBINARY(max)" # else +//# define BLOB_TYPE "RAW(1024)" # define BLOB_TYPE "BLOB" # endif #endif @@ -41,7 +49,16 @@ struct object #pragma db type(BLOB_TYPE) unsigned char uc[1024]; - // Make sure we can still use std::vector<char> as a container. +#ifdef HAVE_CXX11 + #pragma db type(BLOB_TYPE) + std::array<char, 1024> a; + + #pragma db type(BLOB_TYPE) + std::array<char, 1024> ua; +#endif + + // Make sure we can still use std::vector<char> and std::array<char> + // as containers. // std::vector<unsigned char> cont; }; @@ -49,13 +66,16 @@ struct object inline bool operator== (const object& x, const object& y) { - return - x.id_ == y.id_ && - x.vc == y.vc && - x.vuc == y.vuc && - std::memcmp (x.c, y.c, sizeof (x.c)) == 0 && - std::memcmp (x.uc, y.uc, sizeof (x.uc)) == 0 && - x.cont == y.cont; + return x.id_ == y.id_ + && x.vc == y.vc + && x.vuc == y.vuc + && std::memcmp (x.c, y.c, sizeof (x.c)) == 0 + && std::memcmp (x.uc, y.uc, sizeof (x.uc)) == 0 +#ifdef HAVE_CXX11 + && x.a == y.a + && x.ua == y.ua +#endif + && x.cont == y.cont; } #endif // TEST_HXX |