From b9985e9e48a71fc204cef805e2f479f2fc5bb1a1 Mon Sep 17 00:00:00 2001 From: Antonio Carlos Pantaglione Date: Wed, 16 Jul 2003 14:12:32 +0000 Subject: [PATCH] Some changes for speed. --- harbour/ChangeLog | 5 +++++ harbour/contrib/rdd_ads/ads1.c | 24 +++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d6fa94fdec..ba462d446d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-07-16 13:00 UTC-0300 Antonio Carlos Pantaglione + * contrib/rdd_ads/ads1.c + ! Changes in adsPutValue for speed(). Tested with + ADS Local 6.2, not tested with prior versions of ADS. + 2003-07-14 13:50 UTC-0300 Antonio Carlos Pantaglione * 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 7cad2dba4e..f9d1550ead 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -1102,8 +1102,8 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) /* Cannot test for EOF here because related children may not have the eof flag reset yet, yielded erroneous blank results */ - // This code was optimized for use ADSFIELD() macro instead - // AdsGetFieldName() function for speed. Toninho@fwi, 14/07/2003 + /* This code was optimized for use ADSFIELD() macro instead */ + /* AdsGetFieldName() function for speed. Toninho@fwi, 14/07/2003 */ switch( pField->uiType ) { @@ -1234,12 +1234,9 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) LPFIELD pField; USHORT uiCount; BYTE * szText; - BOOL bError; + BOOL bError = TRUE; long lDay, lMonth, lYear; - UNSIGNED8 szName[ ADS_MAX_FIELD_NAME + 1 ]; - /* See adsGetValue() for why we don't use pArea->uiMaxFieldNameLength here */ - UNSIGNED16 pusBufLen = ADS_MAX_FIELD_NAME + 1; UNSIGNED8 pucFormat[ 11 ]; UNSIGNED16 pusLen = 10; UNSIGNED32 ulRetVal; @@ -1256,8 +1253,9 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) pField = pArea->lpFields + uiIndex - 1; szText = pArea->pRecord; - bError = TRUE; - AdsGetFieldName( pArea->hTable, uiIndex, szName, &pusBufLen ); + + /* This code was optimized for use ADSFIELD() macro instead */ + /* AdsGetFieldName() function for speed. Toninho@fwi, 16/07/2003 */ switch( pField->uiType ) { @@ -1267,7 +1265,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) uiCount = ( USHORT ) hb_itemGetCLen( pItem ); if( uiCount > pField->uiLen ) uiCount = pField->uiLen; - AdsSetString( pArea->hTable, szName, (UNSIGNED8*)hb_itemGetCPtr( pItem ), uiCount ); + AdsSetString( pArea->hTable, ADSFIELD( uiIndex ), (UNSIGNED8*)hb_itemGetCPtr( pItem ), uiCount ); bError = FALSE; } break; @@ -1275,7 +1273,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) case HB_IT_LONG: if( HB_IS_NUMERIC( pItem ) ) { - ulRetVal = AdsSetDouble( pArea->hTable, szName, hb_itemGetND( pItem ) ); + ulRetVal = AdsSetDouble( pArea->hTable, ADSFIELD( uiIndex ), hb_itemGetND( pItem ) ); if( ulRetVal != AE_DATA_TOO_LONG ) bError = FALSE; } @@ -1288,7 +1286,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) AdsSetDateFormat ( (UNSIGNED8*)"YYYYMMDD" ); hb_dateDecode( hb_itemGetDL( pItem ), &lYear, &lMonth, &lDay ); hb_dateStrPut( ( char * ) szText, lYear, lMonth, lDay ); - AdsSetDate( pArea->hTable, szName, szText, 8 ); + AdsSetDate( pArea->hTable, ADSFIELD( uiIndex ), szText, 8 ); AdsSetDateFormat ( pucFormat ); bError = FALSE; } @@ -1299,7 +1297,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) { *szText = hb_itemGetL( pItem ) ? 'T' : 'F'; bError = FALSE; - AdsSetLogical( pArea->hTable, szName, hb_itemGetL( pItem ) ); + AdsSetLogical( pArea->hTable, ADSFIELD( uiIndex ), hb_itemGetL( pItem ) ); } break; @@ -1307,7 +1305,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) if( HB_IS_STRING( pItem ) ) { uiCount = ( USHORT ) hb_itemGetCLen( pItem ); - AdsSetString( pArea->hTable, szName, + AdsSetString( pArea->hTable, ADSFIELD( uiIndex ), (UNSIGNED8*)hb_itemGetCPtr( pItem ), uiCount ); bError = FALSE; }