From bb8f397db367de07759e2b1d903a1a8afe790526 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Tue, 30 Apr 2002 08:41:38 +0000 Subject: [PATCH] 2002-04-30 12:46 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 5 +++++ harbour/include/hbrddntx.h | 7 ++++--- harbour/source/rdd/dbfntx/dbfntx1.c | 11 ++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 38398d64ab..d736f5b45b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -7,6 +7,11 @@ For example: 2002-12-01 23:12 UTC+0100 Foo Bar */ + * source/rdd/dbfcdx/dbfcdx2.h + ! fixed gpf reported by Lorenzo Fiorini + + added helper function hb_cdxGoEof + + added default tag name when not specified + * source/rdd/workarea.c ! fixed bof flag in go bottom with no valid records 2002-04-30 20:49 UTC-0300 Horacio Roldan diff --git a/harbour/include/hbrddntx.h b/harbour/include/hbrddntx.h index 3dd3a5659d..d7f2e5dfd7 100644 --- a/harbour/include/hbrddntx.h +++ b/harbour/include/hbrddntx.h @@ -123,7 +123,6 @@ typedef struct HB_PAGEINFO_STRU BOOL Changed; BOOL NewRoot; BOOL lBusy; - BYTE PageType; USHORT uiKeys; SHORT CurKey; char* buffer; @@ -146,6 +145,7 @@ typedef struct _TAGINFO PHB_ITEM bottomScope; BOOL AscendKey; BOOL UniqueKey; + BOOL Custom; BOOL TagChanged; BOOL TagBOF; BOOL TagEOF; @@ -201,10 +201,11 @@ typedef struct _NTXHEADER /* Header of NTX file */ USHORT half_page; char key_expr[ NTX_MAX_KEY ]; char unique; - char unknown; + char unknown1; char descend; - char reserve[7]; + char unknown2; char for_expr[ NTX_MAX_KEY ]; + char custom; } NTXHEADER; typedef NTXHEADER * LPNTXHEADER; diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index 9f7d947e2f..13a5e1684a 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -174,7 +174,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ); static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr, PHB_ITEM pKeyExpr, BYTE bKeyType, USHORT uiKeyLen, USHORT uiKeyDec, char *szForExp, - PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique ); + PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique, BOOL fCustom ); /* Create Compound Tag with information about index */ static LPPAGEINFO hb_ntxPageNew(LPTAGINFO pParentTag ); @@ -2410,6 +2410,8 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) sortInfo.itemLength = sizeof( LPSORTITEM ) + sizeof( ULONG ) + pTag->KeyLength; sortInfo.nItems = 0; sortInfo.pKey1 = sortInfo.pKey2 = sortInfo.pKeyFirst = sortInfo.pKeyTemp = NULL; + if( pArea->lpdbOrdCondInfo && pArea->lpdbOrdCondInfo->fCustom ) + ulRecCount = 0; if( ulRecCount ) { ulRecMax = ulRecCount; @@ -2605,13 +2607,14 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull ) strcpy( Header.for_expr , pIndex->CompoundTag->ForExpr ); Header.unique = pIndex->CompoundTag->UniqueKey; Header.descend = !pIndex->CompoundTag->AscendKey; + Header.custom = pIndex->CompoundTag->Custom; hb_fsWrite( pIndex->DiskFile,(BYTE*)&Header,sizeof(NTXHEADER) ); } else hb_fsWrite( pIndex->DiskFile,(BYTE*)&Header,16 ); } -static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr, PHB_ITEM pKeyExpr, BYTE bKeyType, USHORT uiKeyLen, USHORT uiKeyDec, char *szForExp, PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique ) +static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr, PHB_ITEM pKeyExpr, BYTE bKeyType, USHORT uiKeyLen, USHORT uiKeyDec, char *szForExp, PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique, BOOL fCustom ) { LPTAGINFO pTag; @@ -2632,6 +2635,7 @@ static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr, PHB_ pTag->pForItem = pForExp; pTag->AscendKey = fAscendKey; pTag->UniqueKey = fUnique; + pTag->Custom = fCustom; pTag->KeyType = bKeyType; pTag->KeyLength = uiKeyLen; pTag->KeyDec = uiKeyDec; @@ -2756,6 +2760,7 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN) pTag->pForItem = pForExp; pTag->UniqueKey = Header.unique; pTag->AscendKey = !Header.descend; + pTag->Custom = Header.custom; pTag->KeyType = 'C'; /* bKeyType; */ pTag->KeyLength = Header.key_size; pTag->KeyDec = Header.key_dec; @@ -3462,7 +3467,7 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) pTag = hb_ntxTagNew( pIndex, szTagName, pOrderInfo->abExpr->item.asString.value, pKeyExp, bType, (USHORT) uiLen, (USHORT) uiDec, (char *) ( pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->abFor : NULL ), pForExp, pArea->lpdbOrdCondInfo ? !pArea->lpdbOrdCondInfo->fDescending : TRUE, - pOrderInfo->fUnique ); + pOrderInfo->fUnique, pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->fCustom : FALSE ); pIndex->CompoundTag = pTag; pIndex->DiskFile = hb_spCreate( ( BYTE * ) szFileName , FC_NORMAL );