rowset can not get size
xum07 opened this issue · 1 comments
xum07 commented
rowset support get size by std::distance
. However, if calculate the size by std::distance
first, then the rowset
begin iterator can not point to expected beginning any more. Just like the following code:
rowset<row> rows = (sess.prepare << "select * from mytable"); // assume there are 10 rows
cout << std::distance(rows.begin(), rows.end())<< endl; // here is 10
cout << std::distance(rows.begin(), rows.end())<< endl; // here is 0
vadz commented
rowset_iterator
is an input iterator, so of course it can't be iterated more than once -- so what you see is perfectly normal.