From f1b5b3c28ffbadb3822b267e13a9148accea7555 Mon Sep 17 00:00:00 2001 From: Brian Hays Date: Fri, 29 Sep 2000 07:14:13 +0000 Subject: [PATCH] 2000-09-29 00:13 UTC+0800 Brian Hays --- harbour/ChangeLog | 8 ++++++++ harbour/contrib/rdd_ads/ads1.c | 27 +++++++++++++++++++-------- harbour/source/rdd/dbcmd.c | 26 +++++++++++++++++++++++++- harbour/source/rtl/dummy.prg | 4 ++-- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7e60158a3f..6f9a2d9aff 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +2000-09-29 00:07 UTC+0800 Brian Hays + * contrib/rdd_ads/ads1.c + * source/rdd/dbcmd.c + * source/rtl/dummy.prg + * implemented ordKeyNo() + * fixed checkBofEof need to skipfilter without infinite loop + * ads1.c line 492 added (int) to clear warning re comparing different types + 2000-09-29 09:50 GMT+3 Alexander Kresin * contrib/rdd_ads/ads1.c * contrib/rdd_ads/adsfunc.c diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index 14e12960b5..a27ba85772 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -200,10 +200,12 @@ static ERRCODE hb_adsCheckBofEof( ADSAREAP pArea ) AdsAtBOF( pArea->hTable, (UNSIGNED16 *)&(pArea->fBof) ); AdsAtEOF( pArea->hTable, (UNSIGNED16 *)&(pArea->fEof) ); - if( pArea->fBof && !pArea->fEof ) - AdsSkip ( (pArea->hOrdCurrent) ? pArea->hOrdCurrent:pArea->hTable, 1 ); -/* return SUPER_SKIPFILTER( (AREAP)pArea, 1 ); */ - return SUCCESS; + if( pArea->fBof && !pArea->fEof ) + { + AdsSkip ( (pArea->hOrdCurrent) ? pArea->hOrdCurrent:pArea->hTable, 1 ); + return SUPER_SKIPFILTER( (AREAP)pArea, 1 ); + }else + return SUCCESS; } ERRCODE adsCloseCursor( ADSAREAP pArea ) @@ -292,7 +294,6 @@ static ERRCODE adsGoTo( ADSAREAP pArea, ULONG ulRecNo ) pArea->fValidBuffer = FALSE; AdsGotoRecord( pArea->hTable, ulRecNo ); hb_adsCheckBofEof( pArea ); - // HB_TRACE(HB_TR_ALWAYS, ("afterCheckBE: %lu %lu ", pArea->ulRecNo, ulRecNo )); return SUCCESS; } @@ -522,7 +523,7 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) if( pArea->fEof ) { int i; - for( i=0; i < pArea->maxFieldLen; i++ ) + for( i=0; i < (int) pArea->maxFieldLen; i++ ) *( pBuffer+i ) = ' '; *( pBuffer + ( int ) pField->uiLen ) = '\0'; } @@ -596,7 +597,7 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) UNSIGNED8 *pucBuf; UNSIGNED32 pulLen; - if ( pArea->fEof || + if ( pArea->fEof || AdsGetMemoLength( pArea->hTable, szName, &pulLen ) == AE_NO_CURRENT_RECORD ) hb_itemPutC( pItem, "" ); else @@ -656,7 +657,6 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) if( pArea->uiParents ) { hb_adsCheckBofEof( pArea ); -// xxx can't call this here-- it may skip!!! } if( uiIndex > pArea->uiFieldCount || pArea->fEof ) @@ -1316,6 +1316,17 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde hb_itemPutNI(pOrderInfo->itmResult, usOrder); break; } + case DBOI_RECNO : + { + UNSIGNED32 pulKey ; + if( phIndex ) + AdsGetKeyNum ( phIndex, ADS_RESPECTSCOPES, &pulKey); + else + AdsGetRecordNum ( pArea->hTable, ADS_IGNOREFILTERS, &pulKey); + hb_itemPutNL(pOrderInfo->itmResult, pulKey); + break; + } + } return SUCCESS; } diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 7d9c9bbe24..d877ce15ab 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -2356,6 +2356,30 @@ HB_FUNC( ORDKEY ) hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEY" ); } +#ifdef HB_COMPAT_C53 +HB_FUNC( ORDKEYNO ) +{ + DBORDERINFO pOrderInfo; + + if( s_pCurrArea ) + { + pOrderInfo.itmOrder = hb_param( 1, HB_IT_STRING ); + if( !pOrderInfo.itmOrder ) + pOrderInfo.itmOrder = hb_param( 1, HB_IT_NUMERIC ); + pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING ); + /* Either or both may be NIL */ + + pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 ); + SELF_ORDINFO( ( AREAP ) s_pCurrArea->pArea, DBOI_RECNO, &pOrderInfo ); + hb_retnl( hb_itemGetNL( pOrderInfo.itmResult ) ); + hb_itemRelease( pOrderInfo.itmResult ); + } + else + hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYNO" ); + +} +#endif + HB_FUNC( ORDLISTADD ) { DBORDERINFO pOrderInfo; @@ -3069,4 +3093,4 @@ HB_FUNC( DBFILEPUT ) hb_retl( FALSE ); } -#endif \ No newline at end of file +#endif diff --git a/harbour/source/rtl/dummy.prg b/harbour/source/rtl/dummy.prg index 6b40e8b918..8e61d491e7 100644 --- a/harbour/source/rtl/dummy.prg +++ b/harbour/source/rtl/dummy.prg @@ -45,7 +45,7 @@ FUNCTION ordKeyAdd() ; RETURN .F. FUNCTION ordKeyCount() ; RETURN 0 FUNCTION ordKeyDel() ; RETURN .F. FUNCTION ordKeyGoto() ; RETURN .F. -FUNCTION ordKeyNo() ; RETURN 0 +// FUNCTION ordKeyNo() ; RETURN 0 FUNCTION ordKeyVal() ; RETURN NIL FUNCTION ordSetRelation() ; RETURN NIL FUNCTION ordSkipUnique() ; RETURN .F. @@ -69,4 +69,4 @@ FUNCTION __dbTotal() ; RETURN NIL FUNCTION __dbFList() ; RETURN {} FUNCTION __dbOpenSDF() ; RETURN NIL FUNCTION __dbTrans() ; RETURN NIL -FUNCTION __dbTransRec() ; RETURN NIL \ No newline at end of file +FUNCTION __dbTransRec() ; RETURN NIL