[odb-users] Iterate twice a result object
Boris Kolpackov
boris at codesynthesis.com
Wed Jan 20 12:16:09 EST 2016
Hi Aarón,
Aarón Bueno Villares <abv150ci at gmail.com> writes:
> If I execute a query and get a result<T> object, can I make a double pass
> of the "underlying" stream?
No, it is an input iterator, as specified in the manual.
> A related question: when is the cached result of the query deleted? when
> all copies of the result object are deleted (shared_ptr semantics)? or when
> the first pass reaches to an end?
The cache you are referring to (if there is one; currently it only really
exists for MySQL) is the internal, binary representation of the returned
objects, not the objects themselves. For MySQL it is freed as soon as you
reach the end of the result stream (or if you destroy the result before
reaching the end).
Boris
More information about the odb-users
mailing list