aboutsummaryrefslogtreecommitdiff
path: root/hello/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-02 16:21:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-02 16:21:47 +0200
commit5d60da7c563025101a7a94012bb0facf88add351 (patch)
tree66eb7e3f2501fa4c761c08dcae351d0bc9625806 /hello/driver.cxx
parentc428f1b17bbeee47cb16ecca6992f4bf19e382dd (diff)
Add simple view to hello example
Diffstat (limited to 'hello/driver.cxx')
-rw-r--r--hello/driver.cxx18
1 files changed, 18 insertions, 0 deletions
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<person_stat> r (db->query<person_stat> ());
+
+ // 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.
//