Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-08-19 04:15:35

Caleb Epstein wrote:

> On 8/18/05, Brock Peabody <brock.peabody_at_[hidden]> wrote:
> > The only ones I've used (MySQL, PostgreSQL, Access, DB2) have had random
> > access. In all the code I've written I don't think I've done anything
> > that required random access iterators for the database though.
> Hm, I wasn't aware MySQL offered random-access result iteration
> facilities. I have only used the mysql_fetch_result interface, but

mysql_use_result() presumably?

> now I see mysql_data_seek. Neat. However, random access says to me
> that the client must receive and consume the entire result set from
> the server first. This is not practical for large result sets that
> may not fit into available memory.

Yes, you have to use mysql_store_result() which copies the entire result
set into the client's address space, and allows seeking to arbitrary rows
(but I *think* mysql_data_seek() is like std::advance() on forward
iterators - not true random access - don't quote me on that though. It
might depend whether the rows in the result are a fixed length or not.)

> Personally I don't see a lot of value in the RandomAccess iterators,
> but some may.

Agreed. Despite supporting it in my mysql wrappers, I've never needed it.


Boost list run by bdawes at, gregod at, cpdaniel at, john at