aboutsummaryrefslogtreecommitdiff
path: root/odb/result.hxx
diff options
context:
space:
mode:
authorMichael Shepanski <michael@codesynthesis.com>2014-11-04 16:10:03 +1100
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-10 16:43:00 +0200
commit6375147d5ae76a84dd64f1996cb0d9d501839db6 (patch)
tree1240e3b8c1567fde1ae11d0c93e5b38c15111506 /odb/result.hxx
parent1f217e38f7507758da1d33d46e675e801621aa38 (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 'odb/result.hxx')
-rw-r--r--odb/result.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/odb/result.hxx b/odb/result.hxx
index 93c0dce..5f84342 100644
--- a/odb/result.hxx
+++ b/odb/result.hxx
@@ -209,6 +209,23 @@ namespace odb
return impl_ ? impl_->size () : 0;
}
+ // query_one() and query_value() implementation details.
+ //
+ public:
+ typename object_traits<T>::pointer_type
+ one ();
+
+ bool
+ one (T&);
+
+ // We cannot return by value here since result can be instantiated
+ // for an abstract type (polymorphic abstract base) and it seems
+ // the signature must be valid to the point being able to call the
+ // necessary constructors.
+ //
+ void
+ value (T&);
+
private:
friend class result<const T>;
@@ -222,6 +239,8 @@ namespace odb
}
}
+#include <odb/result.txx>
+
#include <odb/post.hxx>
#endif // ODB_RESULT_HXX