diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-16 12:23:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-16 12:23:25 +0200 |
commit | 19a3dfd0bcb583e246f83a9c01f9218a8b41fd3c (patch) | |
tree | bc1fbb76c20a844f298717ed1d2271656e03e571 /common/access/driver.cxx | |
parent | da9f37e292c9f490e0c0e9b467114d5df70a9a53 (diff) |
Add support for automatically discovering accessor/modifier functions
New options: --{accessor,modifier}-regex, --{accessor,modifier}-regex-trace.
Diffstat (limited to 'common/access/driver.cxx')
-rw-r--r-- | common/access/driver.cxx | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/common/access/driver.cxx b/common/access/driver.cxx index 3e3c96d..79c63bf 100644 --- a/common/access/driver.cxx +++ b/common/access/driver.cxx @@ -37,9 +37,10 @@ main (int argc, char* argv[]) o.i2 (223); o.i3 () = 323; o.i4 () = 423; - o.set_i5 (423); + o.set_i5 (523); o.s1 ("1bc"); memcpy (o.b1 (), "123456789012345", 16); + o.b2 ("123456789012345"); { transaction t (db->begin ()); @@ -219,6 +220,37 @@ main (int argc, char* argv[]) assert (o3.version_ == 2); } } + + // Test basic accessor/modifier functionality. + // + { + using namespace test7; + + object o (1); + o.i1 () = 123; + o.set_i2 (223); + o.setI3 (323); + o.seti4 (423); + o.i5 () = 523; + o.i6 () = 623; + o.SetI7 (723); + memcpy (o.b1 (), "123456789012345", 16); + o.b2 ("123456789012345"); + + { + transaction t (db->begin ()); + db->persist (o); + t.commit (); + } + + { + transaction t (db->begin ()); + auto_ptr<object> p (db->load<object> (o.id_)); + t.commit (); + + assert (o == *p); + } + } } catch (const odb::exception& e) { |