Re: CBulkRowset and MovePrev()

Phil Allan-Harding <[email protected]> Tue, 23 Jul 2002 12:46:18 +0100
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
You're correct, the implementation of MoveLast/MovePrev has bugs in it.
Further the CBulkRowset template will cause a memory leak as it doesn't
always delete the "cache" member variable m_phRow correctly. I fixed the
CBulkRowset template by re-implementing my own "CBulkRowsetEx" template, let
me know if you would like a copy.

Regards,
Phillip Allan-Harding

Graphicboost Ltd.
Tel: +44(0) 161 980 4136
Mobile: +44(0) 7778 561119
Email: [email protected] <mailto:[email protected]>
Web: http://www.graphicboost.com <http://www.graphicboost.com>


-----Original Message-----
From: Rudolf Wiener [mailto:[email protected]]
Sent: Monday, 22 July 2002 21:29
Subject: CBulkRowset and MovePrev()


Hi,

I have a CBulkRowset, opened with DBPROP_CANFETCHBACKWARDS set to true. The
following sequence of statements does not work:

    cmd.MoveLast();
    cmd.MovePrev();
    cmd.MovePrev();

The second of the MovePrev() returns DB_S_ENDOFROWSET while there are still
thousands of records in the database. I stepped through the implementation
of the ATL consumer template and -- while I'm not sure I completely
understand everything that's happening -- I have the impression that there
might be a problem in the implementation. To me it looks like MoveLast()
moves to the last record and reads this one record into the cache. The first
MovePrev() issues a MoveNext(-2,true) which in the implementation moves 2
recs to the beginning of the table and tries to read 10 records into the
cache. At this moment the return code is DB_S_ENDOFROWSET (of course, we're
positioned at the second last record) which is handeled correctly because
the implementation realizes it is working with a cache. The second
MovePrev() however checks for a non-S_OK too early and returns the saved
return code DB_S_ENDOFROWSET.

Am I misinterpreting things here or am I missing to set specific properties
or what?

TIA
Rudi

You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.