From 5d60da7c563025101a7a94012bb0facf88add351 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 2 Oct 2011 16:21:47 +0200 Subject: Add simple view to hello example --- hello/driver.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'hello/driver.cxx') diff --git a/hello/driver.cxx b/hello/driver.cxx index 16b1b75..2b7ba1f 100644 --- a/hello/driver.cxx +++ b/hello/driver.cxx @@ -95,6 +95,24 @@ main (int argc, char* argv[]) } */ + // Print some statistics about all the people in our database. + // + { + transaction t (db->begin ()); + + odb::result r (db->query ()); + + // The result of this query always has exactly one element. + // + const person_stat& ps (*r.begin ()); + + cout << endl + << "count : " << ps.count << endl + << "min age: " << ps.min_age << endl + << "max age: " << ps.max_age << endl; + + t.commit (); + } // John Doe is no longer in our database. // -- cgit v1.1