aboutsummaryrefslogtreecommitdiff
path: root/common/wrapper/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-28 11:39:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-28 14:15:45 +0200
commit83550874e5e879f5e213522dbbe645e9137be8b9 (patch)
tree6257f52ba77df0a6c69bc8fa14e72728f6f86dea /common/wrapper/driver.cxx
parent0e4095ffecdc1f65a48d21730b0c8a0d96bc0c93 (diff)
Add wrapper support for containers
Diffstat (limited to 'common/wrapper/driver.cxx')
-rw-r--r--common/wrapper/driver.cxx38
1 files changed, 33 insertions, 5 deletions
diff --git a/common/wrapper/driver.cxx b/common/wrapper/driver.cxx
index 32ac412..af6a3d1 100644
--- a/common/wrapper/driver.cxx
+++ b/common/wrapper/driver.cxx
@@ -31,9 +31,6 @@ main (int argc, char* argv[])
//
// Simple values.
//
-
- //
- //
unsigned long id;
{
object o;
@@ -50,8 +47,6 @@ main (int argc, char* argv[])
t.commit ();
}
- //
- //
{
transaction t (db->begin ());
auto_ptr<object> o (db->load<object> (id));
@@ -101,6 +96,39 @@ main (int argc, char* argv[])
assert (*o->c2 == *co.c2);
}
}
+
+ //
+ // Containers.
+ //
+ {
+ cont_object co;
+
+ co.vi.reset (new vector<int>);
+ co.vi->push_back (1);
+ co.vi->push_back (2);
+ co.vi->push_back (3);
+
+ co.c.num = 123;
+ co.c.strs.reset (new vector<string>);
+ co.c.strs->push_back ("1");
+ co.c.strs->push_back ("2");
+ co.c.strs->push_back ("3");
+
+ {
+ transaction t (db->begin ());
+ id = db->persist (co);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<cont_object> o (db->load<cont_object> (id));
+ t.commit ();
+
+ assert (*o->vi == *co.vi);
+ assert (o->c == co.c);
+ }
+ }
}
catch (const odb::exception& e)
{