2001-03-30 13:10 GMT+3 Alexander Kresin <alex@belacy.belgorod.su>

This commit is contained in:
Alexander S.Kresin
2001-03-30 09:12:51 +00:00
parent 35bb9fbab3
commit d8165bb195
3 changed files with 83 additions and 6 deletions

View File

@@ -1,3 +1,11 @@
2001-03-30 13:10 GMT+3 Alexander Kresin <alex@belacy.belgorod.su>
* source/rdd/dbfntx/dbfntx1.c
* include/hbrddntx.h
+ started ntxOrderListRebuild()
+ added ntxPack() - will work properly after ntxOrderListRebuild() has
finished
+ added ntxZap()
2001-03-28 00:00 UTC-0800 Brian Hays <bhays@abacuslaw.com>
* contrib/rdd_ads/ads1.c
+ added ADSSetRelKeyPos for quick scrollbar guesstimates

View File

@@ -338,12 +338,12 @@ static ERRCODE ntxClose( NTXAREAP pArea );
static ERRCODE ntxStructSize( NTXAREAP pArea, USHORT * uiSize );
#define ntxSysName NULL
#define ntxEval NULL
#define ntxPack NULL
static ERRCODE ntxPack( NTXAREAP pArea );
#define ntPackRec NULL
#define ntxSort NULL
#define ntxTrans NULL
#define ntxTransRec NULL
#define ntxZap NULL
static ERRCODE ntxZap( NTXAREAP pArea );
#define ntxchildEnd NULL
#define ntxchildStart NULL
#define ntxchildSync NULL
@@ -360,7 +360,7 @@ static ERRCODE ntxOrderListClear( NTXAREAP pArea );
/* Close all indexes */
#define ntxOrderListDelete NULL
static ERRCODE ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo );
#define ntxOrderListRebuild NULL
static ERRCODE ntxOrderListRebuild( NTXAREAP pArea );
#define ntxOrderCondition NULL
static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo );
/* Create new Index */

View File

@@ -2167,6 +2167,59 @@ static ERRCODE ntxStructSize( NTXAREAP pArea, USHORT * uiSize )
return SUCCESS;
}
static ERRCODE ntxPack( NTXAREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("ntxPack(%p)", pArea ));
if( SUPER_PACK( ( AREAP ) pArea ) == SUCCESS )
return ntxOrderListRebuild( pArea );
else
return FAILURE;
}
static ERRCODE ntxZap( NTXAREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("ntxZap(%p)", pArea ));
if( SUPER_ZAP( ( AREAP ) pArea ) == SUCCESS )
{
LPNTXINDEX lpIndex, lpIndexTmp;
LPTAGINFO pTag;
char* buffer;
USHORT i, maxKeys;
LPNTXBUFFER itemlist;
buffer = (char*) hb_xgrab( NTXBLOCKSIZE );
lpIndex = pArea->lpNtxIndex;
lpIndexTmp = pArea->lpCurIndex;
while( lpIndex )
{
lpIndex->CompoundTag->RootBlock = NTXBLOCKSIZE;
hb_ntxHeaderSave( lpIndex );
pTag = lpIndex->CompoundTag;
maxKeys = pTag->MaxKeys*2/3;
memset( buffer, 0, NTXBLOCKSIZE );
itemlist = ( LPNTXBUFFER ) buffer;
itemlist->item_count = 0;
for( i = 0; i < maxKeys + 1; i++ )
itemlist->item_offset[i] = 2 + 2 * ( pTag->MaxKeys + 1 ) +
i * ( pTag->KeyLength + 8 );
hb_fsSeek( lpIndex->DiskFile, NTXBLOCKSIZE, FS_SET );
hb_fsWrite( lpIndex->DiskFile, (BYTE *) buffer, NTXBLOCKSIZE );
hb_fsWrite( lpIndex->DiskFile, NULL, 0 );
lpIndex = lpIndex->pNext;
}
pArea->lpCurIndex = lpIndexTmp;
hb_xfree( buffer );
return SUCCESS;
}
else
return FAILURE;
}
static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
{
PHB_ITEM pExpr, pResult, pError;
@@ -2592,6 +2645,22 @@ static ERRCODE ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo )
return SUCCESS;
}
static ERRCODE ntxOrderListRebuild( NTXAREAP pArea )
{
LPNTXINDEX lpIndex, lpIndexTmp;
HB_TRACE(HB_TR_DEBUG, ("ntxOrderListRebuild(%p)", pArea));
lpIndex = pArea->lpNtxIndex;
lpIndexTmp = pArea->lpCurIndex;
while( lpIndex )
{
lpIndex = lpIndex->pNext;
}
pArea->lpCurIndex = lpIndexTmp;
return SUCCESS;
}
static ERRCODE ntxClose( NTXAREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("ntxClose(%p)", pArea));
@@ -2702,12 +2771,12 @@ static RDDFUNCS ntxTable = { ntxBof,
( DBENTRYP_SP ) ntxStructSize,
ntxSysName,
ntxEval,
ntxPack,
( DBENTRYP_V ) ntxPack,
ntPackRec,
ntxSort,
ntxTrans,
ntxTransRec,
ntxZap,
( DBENTRYP_V ) ntxZap,
ntxchildEnd,
ntxchildStart,
ntxchildSync,
@@ -2722,7 +2791,7 @@ static RDDFUNCS ntxTable = { ntxBof,
( DBENTRYP_V ) ntxOrderListClear,
ntxOrderListDelete,
( DBENTRYP_OI ) ntxOrderListFocus,
ntxOrderListRebuild,
( DBENTRYP_V ) ntxOrderListRebuild,
ntxOrderCondition,
( DBENTRYP_VOC ) ntxOrderCreate,
ntxOrderDestroy,