diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-16 11:46:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-16 11:46:35 +0200 |
commit | fad897c8f3239f6594bd379e42166dc9a528e210 (patch) | |
tree | 0c250ded808f5de333466c152f953030cb16a7f7 | |
parent | 9da1e93b22dc23bb31aa502b82fb7ff999cff879 (diff) |
Test pointer guard in query result
-rw-r--r-- | common/query/driver.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 9c2f9ce..cb19859 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -111,7 +111,19 @@ main (int argc, char* argv[]) { transaction t (db->begin_transaction ()); result r (db->query<person> ("ORDER BY age")); - print (r); + + for (result::iterator i (r.begin ()); i != r.end (); ++i) + { + cout << i->first_name_; + + if (i->middle_name_.get () != 0) + cout << ' ' << *i->middle_name_; + + cout << ' ' << i->last_name_ << ' ' << i->age_ << + (i->married_ ? " married" : " single") << endl; + } + cout << endl; + t.commit (); } |