2000-10-09 2:01 UTC+0800 Brian Hays <bhays@abacuslaw.com>
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
2000-10-09 2:01 UTC+0800 Brian Hays <bhays@abacuslaw.com>
|
||||
* contrib/rdd_ads/adsfunc.c
|
||||
* fixed ADSGETRELKEYPOS to work without an index
|
||||
* contrib/rdd_ads/ads1.c
|
||||
* fixed errors with GoTo 0 in adsGoTo
|
||||
+ added adsSysName() so rddname() works now
|
||||
* maintained ulRecCount in adsOpen, adsPack and adsGoTo
|
||||
* source/rdd/workarea.c
|
||||
* fixed debug trace of changed parameter name
|
||||
|
||||
2000-10-07 21:15 GMT -3 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
*contrib/pdflib/pdfhbdoc.c
|
||||
+code to handle Tables
|
||||
|
||||
@@ -302,11 +302,16 @@ static ERRCODE adsGoBottom( ADSAREAP pArea )
|
||||
|
||||
static ERRCODE adsGoTo( ADSAREAP pArea, ULONG ulRecNo )
|
||||
{
|
||||
//// TODO: bh: Note Explicitly moving to a deleted record when using the Advantage proprietary
|
||||
//// table format (ADT) is an illegal operation and will return the
|
||||
//// error 5022 (AE_INVALID_RECORD_NUMBER), invalid record number.
|
||||
|
||||
ULONG ulRecCount;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("adsGoTo(%p, %lu)", pArea, ulRecNo));
|
||||
|
||||
if( ulRecNo > pArea->ulRecCount )
|
||||
/* Update record count if necessary */
|
||||
if( (pArea->fShared && ulRecNo > pArea->ulRecCount) )
|
||||
{
|
||||
if( adsRecCount( pArea, &ulRecCount ) == FAILURE )
|
||||
return FAILURE;
|
||||
@@ -314,8 +319,25 @@ static ERRCODE adsGoTo( ADSAREAP pArea, ULONG ulRecNo )
|
||||
}
|
||||
|
||||
pArea->fValidBuffer = FALSE;
|
||||
AdsGotoRecord( pArea->hTable, ulRecNo );
|
||||
hb_adsCheckBofEof( pArea );
|
||||
pArea->fFound = FALSE;
|
||||
|
||||
if( ulRecNo > 0 && ulRecNo <= pArea->ulRecCount )
|
||||
{
|
||||
// bh: do we use ulRecno??
|
||||
pArea->ulRecNo = ulRecNo;
|
||||
pArea->fBof = pArea->fEof = FALSE;
|
||||
AdsGotoRecord( pArea->hTable, ulRecNo );
|
||||
//hb_adsCheckBofEof( pArea ); // bh: GoTo should never do the skipfilter that may happen in hb_adsCheckBofEof
|
||||
}
|
||||
else /* GoTo Phantom record */
|
||||
{
|
||||
ulRecNo = 0;
|
||||
if ( !pArea->fEof )
|
||||
AdsGotoRecord( pArea->hTable, ulRecNo );
|
||||
// don't do a GO 0 if already at EOF because we can't skip -1 off of it if you do
|
||||
pArea->ulRecNo = pArea->ulRecCount + 1;
|
||||
pArea->fBof = pArea->fEof = TRUE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -329,8 +351,8 @@ static ERRCODE adsGoToId( ADSAREAP pArea, PHB_ITEM pItem )
|
||||
if( HB_IS_NUMERIC( pItem ) )
|
||||
{
|
||||
ulRecNo = hb_itemGetNL( pItem );
|
||||
if( ulRecNo == 0 )
|
||||
ulRecNo = pArea->ulRecNo;
|
||||
// if( ulRecNo == 0 ) // bh: Go 0 must go to eof!
|
||||
// ulRecNo = pArea->ulRecNo;
|
||||
return adsGoTo( pArea, ulRecNo );
|
||||
}
|
||||
else
|
||||
@@ -417,11 +439,13 @@ static ERRCODE adsSkip( ADSAREAP pArea, LONG lToSkip )
|
||||
pArea->fTop = pArea->fBottom = FALSE;
|
||||
AdsSkip ( (pArea->hOrdCurrent) ? pArea->hOrdCurrent : pArea->hTable, lToSkip );
|
||||
|
||||
hb_adsCheckBofEof( pArea );
|
||||
if ( lToSkip==0 )
|
||||
return SUCCESS; /*bh: dbskip(0) created infinite loop; this should never move the record pointer via skipfilter */
|
||||
else
|
||||
{
|
||||
hb_adsCheckBofEof( pArea );
|
||||
return SUPER_SKIPFILTER( (AREAP)pArea, lToSkip>0 ? 1:-1 );
|
||||
}
|
||||
}
|
||||
|
||||
#define adsSkipFilter NULL
|
||||
@@ -783,6 +807,7 @@ static ERRCODE adsRecCount( ADSAREAP pArea, ULONG * pRecCount )
|
||||
HB_TRACE(HB_TR_DEBUG, ("adsRecCount(%p, %p)", pArea, pRecCount));
|
||||
|
||||
AdsGetRecordCount( pArea->hTable, ADS_IGNOREFILTERS, pRecCount );
|
||||
pArea->ulRecCount = *pRecCount;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -979,7 +1004,7 @@ static ERRCODE adsNewArea( ADSAREAP pArea )
|
||||
static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
{
|
||||
ADSHANDLE hTable;
|
||||
UNSIGNED32 ulRetVal, pulLength;
|
||||
UNSIGNED32 ulRetVal, pulLength, ulRecCount;
|
||||
USHORT uiFields, uiCount;
|
||||
UNSIGNED8 szName[ HARBOUR_MAX_RDD_FIELDNAME_LENGTH + 1 ];
|
||||
UNSIGNED16 pusBufLen, pusType;
|
||||
@@ -1063,6 +1088,9 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
/* Alloc buffer */
|
||||
pArea->pRecord = ( BYTE * ) hb_xgrab( pArea->maxFieldLen + 1 );
|
||||
pArea->fValidBuffer = FALSE;
|
||||
if( adsRecCount( pArea, &ulRecCount ) == FAILURE )
|
||||
return FAILURE;
|
||||
pArea->ulRecCount = ulRecCount;
|
||||
return SELF_GOTOP( ( AREAP ) pArea );
|
||||
}
|
||||
|
||||
@@ -1076,11 +1104,20 @@ static ERRCODE adsStructSize( ADSAREAP pArea, USHORT * StructSize )
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#define adsSysName NULL
|
||||
static ERRCODE adsSysName( ADSAREAP pArea, BYTE * pBuffer )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("adsSysName(%p, %p)", pArea, pBuffer));
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
strcpy(pBuffer, "ADS");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#define adsEval NULL
|
||||
|
||||
static ERRCODE adsPack( ADSAREAP pArea )
|
||||
{
|
||||
ULONG ulRecCount;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("adsPack(%p)", pArea));
|
||||
|
||||
if( pArea->fShared )
|
||||
@@ -1093,6 +1130,9 @@ static ERRCODE adsPack( ADSAREAP pArea )
|
||||
return FAILURE;
|
||||
|
||||
AdsPackTable ( pArea->hTable );
|
||||
if( adsRecCount( pArea, &ulRecCount ) == FAILURE )
|
||||
return FAILURE;
|
||||
pArea->ulRecCount = ulRecCount;
|
||||
return adsGoTop( pArea );
|
||||
}
|
||||
|
||||
|
||||
@@ -431,13 +431,32 @@ HB_FUNC( ADSGETRELKEYPOS )
|
||||
DOUBLE pdPos;
|
||||
|
||||
pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer();
|
||||
if( pArea && pArea->hOrdCurrent )
|
||||
if( pArea )
|
||||
{
|
||||
if ( pArea->hOrdCurrent )
|
||||
{
|
||||
AdsGetRelKeyPos ( pArea->hOrdCurrent, &pdPos);
|
||||
hb_retnd( pdPos );
|
||||
}
|
||||
else
|
||||
{
|
||||
ULONG ulRecCount;
|
||||
AdsGetRecordNum( pArea->hTable, ADS_IGNOREFILTERS,
|
||||
(UNSIGNED32 *)&(pArea->ulRecNo) );
|
||||
AdsGetRecordCount( pArea->hTable, ADS_IGNOREFILTERS, &ulRecCount );
|
||||
if ( pArea->ulRecNo == 0 || ulRecCount == 0 )
|
||||
hb_retnd( 0.0 );
|
||||
else
|
||||
{
|
||||
if ( pArea->fEof )
|
||||
hb_retnd( 1.0 );
|
||||
else
|
||||
hb_retnd( (double) pArea->ulRecNo/ ulRecCount );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSREFRESHAOF" );
|
||||
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSGETRELKEYPOS" );
|
||||
}
|
||||
|
||||
HB_FUNC( ADSENABLEENCRYPTION )
|
||||
@@ -773,7 +792,7 @@ HB_FUNC( ADSCONVERTTABLE )
|
||||
usTableType = hb_parni( 2 );
|
||||
if( usTableType < 1 || usTableType > 3 )
|
||||
usTableType = ADS_ADT;
|
||||
}
|
||||
}
|
||||
AdsConvertTable( pArea->hTable, ADS_IGNOREFILTERS, hb_parc( 1 ), usTableType );
|
||||
}
|
||||
else
|
||||
@@ -785,4 +804,4 @@ HB_FUNC( ADSCONVERTTABLE )
|
||||
else
|
||||
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, " ADSCONVERTTABLE" );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO lpdbRelInf )
|
||||
{
|
||||
LPDBRELINFO lpdbRelations;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waSetRel(%p, %p)", pArea, pRelInfo));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waSetRel(%p, %p)", pArea, lpdbRelInf));
|
||||
|
||||
lpdbRelations = pArea->lpdbRelations;
|
||||
if( ! lpdbRelations )
|
||||
|
||||
Reference in New Issue
Block a user