From f94630effc941b405e2ae4c99118df2c3a9ac743 Mon Sep 17 00:00:00 2001 From: Horacio Dario Roldan Kasimatis Date: Fri, 26 Oct 2001 19:04:12 +0000 Subject: [PATCH] 2001-10-26 15:21 GMT-3 Horacio Roldan * source/rdd/dbfcdx/dbfcdx1.c * OrderListAdd now reorder the Tag List of the opened CDX by its position in the CDX instead of its tag name. (for Clipper compatibility) --- harbour/ChangeLog | 6 ++++ harbour/source/rdd/dbfcdx/dbfcdx1.c | 44 +++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 99fc198454..63af441342 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2001-10-26 15:21 GMT-3 Horacio Roldan + * source/rdd/dbfcdx/dbfcdx1.c + * OrderListAdd now reorder the Tag List of the opened CDX by its + position in the CDX instead of its tag name. (for Clipper + compatibility) + 2001-10-26 13:15 GMT-3 Horacio Roldan * source/rdd/dbfcdx/dbfcdx1.c * Re-disabled temporally SUPER call to ignore unsupported ordinfo items diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index ba4da33121..fec7f6003a 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -4079,6 +4079,8 @@ ERRCODE hb_cdxOrderListAdd( CDXAREAP pAreaCdx, LPDBORDERINFO pOrderInfo ) PHB_ITEM pError = NULL; BOOL bRetry; LPCDXTAG pTag, pLastTag; + LPCDXTAG TagList, pTag1, pTag2, pTagTmp; + HB_TRACE(HB_TR_DEBUG, ("cdxOrderListAdd(%p, %p)", pArea, pOrderInfo)); @@ -4154,22 +4156,58 @@ ERRCODE hb_cdxOrderListAdd( CDXAREAP pAreaCdx, LPDBORDERINFO pOrderInfo ) pIndex->pCompound->OptFlags = 0xE0; hb_cdxIndexResetAvailPage( pIndex ); hb_cdxTagTagOpen( pIndex->pCompound, 0 ); + TagList = NULL; while( !pIndex->pCompound->TagEOF ) { pTag = hb_cdxTagNew( pIndex, pIndex->pCompound->CurKeyInfo->Value, pIndex->pCompound->CurKeyInfo->Tag ); - if( pIndex->TagList == NULL ) - pIndex->TagList = pTag; + if( TagList == NULL ) + TagList = pTag; else { - pLastTag = pIndex->TagList; + pLastTag = TagList; while( pLastTag->pNext ) pLastTag = pLastTag->pNext; pLastTag->pNext = pTag; } hb_cdxTagKeyRead( pIndex->pCompound, NEXT_RECORD ); } + /* Reorder the Tag list to be compatible with Clipper */ + pTag1 = TagList; + while (pTag1->pNext) + { + if (pTag1->TagBlock < pTag1->pNext->TagBlock) + pTag1 = pTag1->pNext; + else + { + if ( TagList->TagBlock > pTag1->pNext->TagBlock) + { + pTagTmp = TagList; + TagList = pTag1->pNext; + pTag1->pNext = pTagTmp; + } + else + { + pTag2 = TagList; + while (pTag2->pNext && (pTag2->pNext->TagBlock < pTag1->pNext->TagBlock) ) + pTag2 = pTag2->pNext; + pTagTmp = pTag2->pNext; + pTag2->pNext = pTag1->pNext; + pTag1->pNext = pTagTmp; + } + } + } + if( pIndex->TagList == NULL ) + pIndex->TagList = TagList; + else + { + pLastTag = pIndex->TagList; + while( pLastTag->pNext ) + pLastTag = pLastTag->pNext; + pLastTag->pNext = TagList; + } + /*missing: ordSetFocus(1) if there was no other open index in the area*/ pIndex->uiTag = 1; SELF_GOTOP( ( AREAP ) pArea );