From 0b7fe71055e85eb0eeeebaff3f35ad46b4b8c54c Mon Sep 17 00:00:00 2001 From: Miguel Angel Marchuet Frutos Date: Fri, 25 May 2007 08:47:17 +0000 Subject: [PATCH] 2007-05-25 11:46 UTC+0100 Miguel Angel Marchuet (miguelangel/at/marchuet.net) * contrib/bmdbfcdx/bmdbfcdx1.c * removed unnecesary code ! fixed bug on SKIP with SET DELETED ON when skips a deleted recno, OrdKeyNo was wrong. --- harbour/ChangeLog | 5 +++++ harbour/contrib/bmdbfcdx/bmdbfcdx1.c | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 84bad960bb..89c2e2075a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-05-25 11:46 UTC+0100 Miguel Angel Marchuet (miguelangel/at/marchuet.net) + * contrib/bmdbfcdx/bmdbfcdx1.c + * removed unnecesary code + ! fixed bug on SKIP with SET DELETED ON when skips a deleted recno, OrdKeyNo was wrong. + 2007-05-25 01:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/include/hbexpra.c diff --git a/harbour/contrib/bmdbfcdx/bmdbfcdx1.c b/harbour/contrib/bmdbfcdx/bmdbfcdx1.c index e96b79553f..5dfb27f7bc 100644 --- a/harbour/contrib/bmdbfcdx/bmdbfcdx1.c +++ b/harbour/contrib/bmdbfcdx/bmdbfcdx1.c @@ -4965,7 +4965,7 @@ static LPCDXINDEX hb_cdxFindBag( CDXAREAP pArea, char * szBagName ) if ( szBasePath ) hb_xfree( szBasePath ); if ( szBaseExt ) - hb_xfree( szBaseExt ); + hb_xfree( szBaseExt ); return pIndex; } @@ -6942,7 +6942,7 @@ static ERRCODE hb_cdxSkip( CDXAREAP pArea, LONG lToSkip ) } else if ( ulPos ) { - pTag->logKeyPos += lToSkip - ( ulPos ? 0 : 1 ); + pTag->logKeyPos += lToSkip; pTag->logKeyRec = pArea->ulRecNo; } } @@ -6956,7 +6956,7 @@ static ERRCODE hb_cdxSkip( CDXAREAP pArea, LONG lToSkip ) } else if ( ulPos ) { - pTag->logKeyPos += lToSkip + ( ulPos ? 0 : 1 ); + pTag->logKeyPos += lToSkip; pTag->logKeyRec = pArea->ulRecNo; } } @@ -6992,12 +6992,16 @@ ERRCODE hb_cdxSkipFilter( CDXAREAP pArea, LONG lUpDown ) /* SET DELETED */ if( hb_set.HB_SET_DELETED ) { + LPCDXTAG pTag = hb_cdxGetActiveTag( pArea ); + if( SELF_DELETED( (AREAP) pArea, &fDeleted ) != SUCCESS ) return FAILURE; if( fDeleted ) { if( SELF_SKIPRAW( (AREAP) pArea, lUpDown ) != SUCCESS ) return FAILURE; + else if ( pTag ) + pTag->logKeyPos += lUpDown; continue; } } @@ -8563,7 +8567,7 @@ static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO case DBOI_RELKEYPOS: if ( pOrderInfo->itmNewVal && HB_IS_NUMERIC( pOrderInfo->itmNewVal ) ) - hb_cdxDBOISetRelKeyPos( pArea, pTag, + hb_cdxDBOISetRelKeyPos( pArea, pTag, hb_itemGetND( pOrderInfo->itmNewVal ) ); else pOrderInfo->itmResult = hb_itemPutND( pOrderInfo->itmResult, @@ -8578,7 +8582,7 @@ static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO case DBOI_FINDRECCONT: pOrderInfo->itmResult = hb_itemPutL( pOrderInfo->itmResult, - hb_cdxDBOIFindRec( pArea, pTag, + hb_cdxDBOIFindRec( pArea, pTag, hb_itemGetNL( pOrderInfo->itmNewVal ), TRUE ) ); break; @@ -8826,7 +8830,7 @@ static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO SELF_FORCEREL( ( AREAP ) pArea ); if( !pArea->fPositioned || - ( pTag->pForItem && + ( pTag->pForItem && !hb_cdxEvalCond( pArea, pTag->pForItem, TRUE ) ) ) { pOrderInfo->itmResult = hb_itemPutL( pOrderInfo->itmResult, FALSE ); @@ -8865,7 +8869,7 @@ static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO SELF_FORCEREL( ( AREAP ) pArea ); if( !pArea->fPositioned || - ( pTag->pForItem && + ( pTag->pForItem && !hb_cdxEvalCond( pArea, pTag->pForItem, TRUE ) ) ) { pOrderInfo->itmResult = hb_itemPutL( pOrderInfo->itmResult, FALSE ); @@ -9916,8 +9920,8 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, BOOL fReindex ) if( ulNextCount > 0 && ulNextCount < ( ULONG ) iRec ) iRec = ( int ) ulNextCount; hb_fsSeekLarge( pArea->hDataFile, - ( HB_FOFFSET ) pArea->uiHeaderLen + - ( HB_FOFFSET ) ( ulRecNo - 1 ) * + ( HB_FOFFSET ) pArea->uiHeaderLen + + ( HB_FOFFSET ) ( ulRecNo - 1 ) * ( HB_FOFFSET ) pArea->uiRecordLen, FS_SET ); hb_fsReadLarge( pArea->hDataFile, pSort->pRecBuff, pArea->uiRecordLen * iRec ); iRecBuff = 0;