aboutsummaryrefslogtreecommitdiff
path: root/common/wrapper/test.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-29 21:12:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-29 21:12:26 +0200
commitda13cf5463a3d047c8b52c5b95b00b203e56eb2d (patch)
tree933146cfa28221ddec0ba680fa1265e099a8d8d0 /common/wrapper/test.hxx
parent00f25fc7183f5508f0cc6f8798e634c76434ce0e (diff)
Factor TR1/C++11 shared_ptr test into separate object2.0.0
The current approach causes problems with foreign key constraints during table dropping.
Diffstat (limited to 'common/wrapper/test.hxx')
-rw-r--r--common/wrapper/test.hxx59
1 files changed, 34 insertions, 25 deletions
diff --git a/common/wrapper/test.hxx b/common/wrapper/test.hxx
index 399073d..f308409 100644
--- a/common/wrapper/test.hxx
+++ b/common/wrapper/test.hxx
@@ -20,46 +20,55 @@
using odb::nullable;
+// Test 1: simple values.
//
-// Simple values.
-//
-
-typedef nullable<std::string> nullable_string;
+#pragma db namespace table("t1_")
+namespace test1
+{
+ typedef nullable<std::string> nullable_string;
#ifdef HAVE_CXX11
-typedef std::unique_ptr<int> num_uptr;
-typedef std::unique_ptr<std::string> str_uptr;
-typedef std::shared_ptr<std::string> str_sptr;
+ typedef std::unique_ptr<int> num_uptr;
+ typedef std::unique_ptr<std::string> str_uptr;
+ typedef std::shared_ptr<std::string> str_sptr;
#else
-typedef std::auto_ptr<int> num_uptr;
-typedef std::auto_ptr<std::string> str_uptr;
+ typedef std::auto_ptr<int> num_uptr;
+ typedef std::auto_ptr<std::string> str_uptr;
# ifdef HAVE_TR1_MEMORY
-typedef std::tr1::shared_ptr<std::string> str_sptr;
+ typedef std::tr1::shared_ptr<std::string> str_sptr;
# endif
#endif
-#pragma db object table("obj")
-struct object
-{
- #pragma db id auto
- unsigned long id_;
+ #pragma db object table("obj1")
+ struct object1
+ {
+ #pragma db id auto
+ unsigned long id_;
+
+ num_uptr num;
- num_uptr num;
+ #pragma db null
+ str_uptr str;
- #pragma db null
- str_uptr str;
+ nullable_string nstr;
+ std::vector<nullable_string> nstrs;
+ };
- nullable_string nstr;
- std::vector<nullable_string> nstrs;
+ #pragma db object
+ struct object2
+ {
+ #pragma db id auto
+ unsigned long id_;
#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY)
- #pragma db null
- str_sptr sstr;
+ #pragma db null
+ str_sptr sstr;
- #pragma db value_null
- std::vector<str_sptr> sstrs;
+ #pragma db value_null
+ std::vector<str_sptr> sstrs;
#endif
-};
+ };
+}
//
// Composite values.