Hello,
On 23/02/2011 05:03, William Doughty wrote:
> The following code segment produces unexpected results when
> extracting data from a postgres SELECT query
>
> rowset<row>::const_iterator i = rs.begin();
> for (i=rs.begin(); i != rs.end(); ++i)
> {
> // do something
> }
>
> The calls to rs.begin() increment the row counter in backend fetch
> for each call. The first begin returns the first row, the subsequent
> begin call increments the row counter and returns the next row, not the
> first row.
This is because the rowset iterator is an input iterator, not a forward
iterator. You should not expect repeatable results with multiple
invocations to the same result set.
Regards,
--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users