From eae9d8a277ab7d20228ac84bde36c75ef1d7b74d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Nov 2010 18:47:05 +0200 Subject: Simplify hello example by using id returned from persist() --- hello/driver.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'hello/driver.cxx') diff --git a/hello/driver.cxx b/hello/driver.cxx index ad4ef57..61c3797 100644 --- a/hello/driver.cxx +++ b/hello/driver.cxx @@ -34,17 +34,13 @@ main (int argc, char* argv[]) transaction t (db->begin ()); - db->persist (john); - db->persist (jane); - db->persist (joe); + // Make objects persistent and save their ids for later use. + // + john_id = db->persist (john); + jane_id = db->persist (jane); + joe_id = db->persist (joe); t.commit (); - - // Save object ids for later use. - // - john_id = john.id (); - jane_id = jane.id (); - joe_id = joe.id (); } typedef odb::query query; -- cgit v1.1