diff options
author | Michael Shepanski <michael@codesynthesis.com> | 2014-11-06 16:33:35 +1100 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-10 16:48:13 +0200 |
commit | 51a01cfebf933d270bf7b7fadb0fb3ca3b7a4cd5 (patch) | |
tree | 40ca9efb48c65e88822bcb7538d64bf1299d7aaf /relationship | |
parent | f7d0e9c620d7c3117074e2618f2bc75699d6f2f0 (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 'relationship')
-rw-r--r-- | relationship/driver.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/relationship/driver.cxx b/relationship/driver.cxx index 9af06a2..27a31b2 100644 --- a/relationship/driver.cxx +++ b/relationship/driver.cxx @@ -132,10 +132,9 @@ main (int argc, char* argv[]) shared_ptr<employer> csi (db->load<employer> ("Complex Systems Inc")); shared_ptr<project> ch (db->load<project> ("Complex Hardware")); - 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->projects ().clear (); |