From c7c0b50c7a808e0791a9433e017951191869f2bc Mon Sep 17 00:00:00 2001
From: Boris Kolpackov
The result_not_cached
exception is thrown by
+ the query result class. Refer to Section 4.3,
+ "Query Result" for details.
The database_exception
is a base class for all
database system-specific exceptions that are thrown by the
database system-specific runtime library. See (@@ ref Chapter
@@ -2245,6 +2255,27 @@ namespace odb
+
The in()
function accepts maximum of five argumets.
+ Use the in_range()
function if you need to compare
+ to more than five values. This function accepts a pair of
+ standard C++ iterators and compares to all the value from
+ the begin
position inclusive and until and
+ excluding the end
position. The following
+ code fragment shows how we can use these functions:
+ std::vector<string> names; + + names.push_back ("John"); + names.push_back ("Jack"); + names.push_back ("Jane"); + + query q1 (query::first.in ("John", "Jack", "Jane")); + query q2 (query::first.in_range (names.begin (), names.end ())); ++ + +
The operator precedence in the query expressions are the same
as for equivalent C++ operators. You can use parentheses to
make sure the expression is evaluated in the desired order.
@@ -2418,13 +2449,24 @@ namespace odb
operator= (const result&);
void
- cache ();
+ swap (result&)
+ public:
iterator
begin ();
iterator
end ();
+
+ public:
+ void
+ cache ();
+
+ bool
+ empty () const;
+
+ std::size_t
+ size () const;
};
}
@@ -2458,6 +2500,13 @@ namespace odb
executing any other database function, such as update()
or erase()
will also invalidate the uncached result.
The empty()
function returns true
if
+ there are no objects in the result and false
otherwise.
+ The size()
function can only be called for cached results.
+ It returns the number of objects in the result. If you call this
+ function on an uncached result, the odb::result_not_cached
+ exception is thrown.
To iterate over the objects in a result we use the
begin()
and end()
functions
together with the odb::result<T>::iterator
--
cgit v1.1