aboutsummaryrefslogtreecommitdiff
path: root/inverse
diff options
context:
space:
mode:
authorMichael Shepanski <michael@codesynthesis.com>2014-11-06 16:33:35 +1100
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-10 16:48:13 +0200
commit51a01cfebf933d270bf7b7fadb0fb3ca3b7a4cd5 (patch)
tree40ca9efb48c65e88822bcb7538d64bf1299d7aaf /inverse
parentf7d0e9c620d7c3117074e2618f2bc75699d6f2f0 (diff)
Implement {query,execute}_{one,value}() shortcut functions
Useful in situations where the query is know to return at most one element (*_one) or exactly one element (*_value).
Diffstat (limited to 'inverse')
-rw-r--r--inverse/driver.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/inverse/driver.cxx b/inverse/driver.cxx
index d521579..5a613e1 100644
--- a/inverse/driver.cxx
+++ b/inverse/driver.cxx
@@ -202,7 +202,6 @@ main (int argc, char* argv[])
//
{
typedef odb::query<employee> query;
- typedef odb::result<employee> result;
session s;
transaction t (db->begin ());
@@ -216,10 +215,9 @@ main (int argc, char* argv[])
//
shared_ptr<position> se (new position ("Software Engineer"));
- result r (db->query<employee> (query::first == "John" &&
- query::last == "Doe"));
-
- shared_ptr<employee> john (r.begin ().load ());
+ shared_ptr<employee> john (
+ db->query_one<employee> (query::first == "John" &&
+ query::last == "Doe"));
john->employer (csi);
john->position (se);