From 51a01cfebf933d270bf7b7fadb0fb3ca3b7a4cd5 Mon Sep 17 00:00:00 2001 From: Michael Shepanski Date: Thu, 6 Nov 2014 16:33:35 +1100 Subject: 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). --- relationship/driver.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'relationship/driver.cxx') 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 csi (db->load ("Complex Systems Inc")); shared_ptr ch (db->load ("Complex Hardware")); - result r (db->query (query::first == "John" && - query::last == "Doe")); - - shared_ptr john (r.begin ().load ()); + shared_ptr john ( + db->query_one (query::first == "John" && + query::last == "Doe")); john->employer (csi); john->projects ().clear (); -- cgit v1.1