On Tue, 29 Dec 2009, Mindaugas Kavaliauskas wrote: Hi,
> >It's defined indirectly by dynamic descend flag which causes > >that seek last should work like in Harbour native RDDs and > >CL53/COMIX. In such implementation seek last is fully revertible > >by switching to descending order ( ordDescend(,,!ordDescend()) ) > >and forward seek. Otherwise we will have some anomalies. > Ok, if understand the idea of seeklast now, then it means "try doing > seek backward (in reversed index order, like using DESCEND)", but > not "return the last record (having maximal recno value) of the > records having the same key value". Too much complicated for me ;-) I rather suggest you to think about functionality. This code: dbSeek( dtFirst, .T., .F. ) while field->DATE <= dtLast .and. !EOF() [...] dbSkip( 1 ) enddo should scan the same record set as this code: dbSeek( dtLast, .T., .T. ) while field->DATE >= dtFirst .and. !BOF() [...] dbSkip( -1 ) enddo and this also precisely defines which record should be chosen when the exact key does not exists and for soft seek last. > But ADS still have bug in the first test. If softseek positions at > EOF seeklast does not help to stop on last record. Here is the test > indicating both correct (in some cases) and wrong (in another cases) > behavior of ADS: Yes, and your patch is correct though probably we can remove AdsAtEOF() checking and always call: u32RetVal = AdsSkip( pArea->hOrdCurrent, -1 ); I also suggest to store in u32RetVal AdsSeek() and AdsSeekLast() results and move: if( u32RetVal != AE_SUCCESS ) { commonError( pArea, EG_CORRUPTION, ( HB_ERRCODE ) u32RetVal, 0, NULL, EF_CANDEFAULT, NULL ); return HB_FAILURE; } to always generate RTE also when AdsSeek*() fails. Please only check the AdsSeek*() results for empty ADT and DBF tables. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour