From 521596e38974a68a60dbc8eb083cc881bb11914f Mon Sep 17 00:00:00 2001 From: Michael Shepanski Date: Tue, 4 Nov 2014 16:10:03 +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). --- odb/pgsql/database.hxx | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'odb/pgsql/database.hxx') diff --git a/odb/pgsql/database.hxx b/odb/pgsql/database.hxx index 2a70e96..dda8d31 100644 --- a/odb/pgsql/database.hxx +++ b/odb/pgsql/database.hxx @@ -288,6 +288,68 @@ namespace odb result query (const odb::query_base&); + // Query one API. + // + template + typename object_traits::pointer_type + query_one (); + + template + bool + query_one (T& object); + + template + T + query_value (); + + template + typename object_traits::pointer_type + query_one (const char*); + + template + bool + query_one (const char*, T& object); + + template + T + query_value (const char*); + + template + typename object_traits::pointer_type + query_one (const std::string&); + + template + bool + query_one (const std::string&, T& object); + + template + T + query_value (const std::string&); + + template + typename object_traits::pointer_type + query_one (const pgsql::query_base&); + + template + bool + query_one (const pgsql::query_base&, T& object); + + template + T + query_value (const pgsql::query_base&); + + template + typename object_traits::pointer_type + query_one (const odb::query_base&); + + template + bool + query_one (const odb::query_base&, T& object); + + template + T + query_value (const odb::query_base&); + // Query preparation. // template -- cgit v1.1