From: Corwin Joy (cjoy_at_[hidden])
Date: 2002-11-26 14:05:56
Very perceptive :-). Actually that is the one major feature we are still
missing that I would like to add. In fact, a big obstacle to adding
random-access type iterators is that I have not yet figured out the
right way to design them. It is actually a bit tricky. Here is the
problem. In ODBC you have what is called a statement handle,
hstmt for short, which holds a handle to a scrollable recordset.
The design issue I am struggling with is what happens when you
copy an iterator?
Idea 1: Create a new statement handle. This has problems because
if you create a new statment handle you will be looking at a different
recordset and so may not have exactly the same "position" or set
of records which invalidates most random access algorithms. The
idea behind scrollable recordsets is that when you crate the
statement handle it takes a particular version "snapshot" of the records
so that you can work with a consistent set.
Idea 2: Use the same statement handle. You can kind of get away with
this as long as you are scrolling around within the same buffer of records
used by the original iterator. As soon as you leave that buffer you then
into messy issues of how to manage grabbing a new set of records without
affecting the old iterator. One way would be to just keep around old
buffers but if you have several copies of the iterator
pointing to different places this could really start to chew up memory.
Anyway, I need to do a bit more research to see if there is a way of working
with a copy of a recordset so that I can have multiple copies of an iterator
in an efficient way. If you have a suggestion I would be glad to hear it.
For input and output iterators the above issue is not a problem, we just
a new statement handle just-in-time if we need it. Input and output
iterators don't guarantee
a particular order on the records they retrieve.
"Bill Seymour" <bill-at-the-office_at_[hidden]> wrote in message
> Corwin Joy wrote:
> > Just wanted to post a brief note to mention that we have released
> > version 3.4 of the C++ Database Template Library.
> > ...
> > The website for our free, open source library is:
> > http://dtemplatelib.sourceforge.net/index.htm
> At first glance, this is very interesting.
> Is there any work going on to support scroll cursors?
> The interface could be a kind of read-only random-access
> iterator. scrolling_const_select_iterator?
> --Bill Seymour
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk