2003-04-16 22:10 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2003-04-16 22:10 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
|
||||
* include/hbrddntx.h
|
||||
* source/rdd/dbfntx/dbfntx1.c
|
||||
* Added possibility to save/load and use tag name as in Clipper's DBFNTX
|
||||
|
||||
2003-04-16 14:50 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
|
||||
* source/rdd/dbfntx/dbfntx1.c
|
||||
* A bug in hb_ntxTagKeyCount() fixed - reported by Jos© Luis Capel
|
||||
|
||||
@@ -142,6 +142,7 @@ typedef struct _TAGINFO
|
||||
PHB_ITEM pForItem;
|
||||
PHB_ITEM topScope;
|
||||
PHB_ITEM bottomScope;
|
||||
BOOL fTagName;
|
||||
BOOL AscendKey;
|
||||
BOOL UniqueKey;
|
||||
BOOL Custom;
|
||||
@@ -207,6 +208,7 @@ typedef struct _NTXHEADER /* Header of NTX file */
|
||||
char descend;
|
||||
char unknown2;
|
||||
char for_expr[ NTX_MAX_KEY ];
|
||||
char tag_name[ 12 ];
|
||||
char custom;
|
||||
} NTXHEADER;
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ static void hb_ntxIndexFree( LPNTXINDEX pIndex );
|
||||
static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex );
|
||||
/* Create index from database */
|
||||
|
||||
static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr,
|
||||
static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, BOOL fTagName, char *szKeyExpr,
|
||||
PHB_ITEM pKeyExpr, BYTE bKeyType, USHORT uiKeyLen, USHORT uiKeyDec, char *szForExp,
|
||||
PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique, BOOL fCustom, BOOL fMemory );
|
||||
/* Create Compound Tag with information about index */
|
||||
@@ -2650,6 +2650,8 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull )
|
||||
strcpy( Header.key_expr , pIndex->CompoundTag->KeyExpr );
|
||||
if( pIndex->CompoundTag->ForExpr )
|
||||
strcpy( Header.for_expr , pIndex->CompoundTag->ForExpr );
|
||||
if( pIndex->CompoundTag->fTagName )
|
||||
strcpy( Header.tag_name , pIndex->CompoundTag->TagName );
|
||||
Header.unique = pIndex->CompoundTag->UniqueKey;
|
||||
Header.descend = !pIndex->CompoundTag->AscendKey;
|
||||
Header.custom = pIndex->CompoundTag->Custom;
|
||||
@@ -2661,7 +2663,7 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull )
|
||||
hb_fsWrite( pIndex->DiskFile,(BYTE*)&Header,16 );
|
||||
}
|
||||
|
||||
static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr,
|
||||
static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, BOOL fTagName, char *szKeyExpr,
|
||||
PHB_ITEM pKeyExpr, BYTE bKeyType, USHORT uiKeyLen, USHORT uiKeyDec,
|
||||
char *szForExp, PHB_ITEM pForExp, BOOL fAscendKey, BOOL fUnique,
|
||||
BOOL fCustom, BOOL fMemory )
|
||||
@@ -2671,6 +2673,7 @@ static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, char *szKeyExpr,
|
||||
pTag = ( LPTAGINFO ) hb_xgrab( sizeof( TAGINFO ) );
|
||||
memset( pTag, 0, sizeof( TAGINFO ) );
|
||||
pTag->TagName = ITN;
|
||||
pTag->fTagName = fTagName;
|
||||
pTag->Owner = PIF;
|
||||
if( szKeyExpr )
|
||||
{
|
||||
@@ -2805,8 +2808,18 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN)
|
||||
pIndex->NextAvail = Header.next_page;
|
||||
pTag->TagBlock = ulPos - 1024;
|
||||
pTag->RootBlock = Header.root;
|
||||
pTag->TagName = (char *) hb_xgrab( strlen( ITN ) + 1 );
|
||||
hb_strncpyUpper( pTag->TagName, ITN, strlen( ITN ) );
|
||||
if( Header.tag_name[0] > 20 )
|
||||
{
|
||||
pTag->fTagName = TRUE;
|
||||
pTag->TagName = (char *) hb_xgrab( strlen( Header.tag_name ) + 1 );
|
||||
hb_strncpyUpper( pTag->TagName, Header.tag_name, strlen( Header.tag_name ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pTag->fTagName = FALSE;
|
||||
pTag->TagName = (char *) hb_xgrab( strlen( ITN ) + 1 );
|
||||
hb_strncpyUpper( pTag->TagName, ITN, strlen( ITN ) );
|
||||
}
|
||||
pTag->KeyExpr = (char *) hb_xgrab( NTX_MAX_KEY );
|
||||
strcpy( pTag->KeyExpr, Header.key_expr );
|
||||
|
||||
@@ -3616,13 +3629,25 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
|
||||
hb_itemRelease( pExtInfo.itmResult );
|
||||
}
|
||||
}
|
||||
szTagName = ( char * ) hb_xgrab( strlen( pFileName->szName ) + 1 );
|
||||
hb_strncpyUpper( szTagName, pFileName->szName, strlen( pFileName->szName ) );
|
||||
|
||||
if( pOrderInfo->atomBagName )
|
||||
{
|
||||
int iTagNameLen = strlen( pOrderInfo->atomBagName );
|
||||
if( iTagNameLen > 10 )
|
||||
iTagNameLen = 10;
|
||||
szTagName = ( char * ) hb_xgrab( iTagNameLen + 1 );
|
||||
hb_strncpyUpper( szTagName, pOrderInfo->atomBagName, iTagNameLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
szTagName = ( char * ) hb_xgrab( strlen( pFileName->szName ) + 1 );
|
||||
hb_strncpyUpper( szTagName, pFileName->szName, strlen( pFileName->szName ) );
|
||||
}
|
||||
hb_xfree( pFileName );
|
||||
|
||||
pIndex = hb_ntxIndexNew( pArea );
|
||||
pIndex->IndexName = szFileName;
|
||||
pTag = hb_ntxTagNew( pIndex, szTagName, pOrderInfo->abExpr->item.asString.value,
|
||||
pTag = hb_ntxTagNew( pIndex, szTagName, (pOrderInfo->atomBagName)? 1:0, 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, pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->fCustom : FALSE,
|
||||
|
||||
Reference in New Issue
Block a user