diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9a0f603108..54f92ae435 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,23 @@ +2001-05-27 02:19 UTC-0800 Brian Hays + + * source/rdd/dbcmd.c + * fixed ordListAdd pointer bug reported by JF + + * contrib/rdd_ads/ads.ch + + added COMMIT command to call AdsWriteAllRecords + (our dbCommitAll() loops through all workareas. AdsWriteAllRecords + is an optimized single call to the server.) + + * contrib/rdd_ads/ads1.c + * corrected commit to only flush current workarea + * fixed DBOI_ORDERCOUNT parameter handling + + * contrib/rdd_ads/adsfunc.c + + added AdsWriteAllRecords() & AdsGetNumIndexes() + + * contrib\rdd_ads\doc\en\readme.txt + * minor edits + 2001-05-26 10:25 UTC-0800 Brian Hays * source/rdd/dbcmd.c diff --git a/harbour/contrib/rdd_ads/ads.ch b/harbour/contrib/rdd_ads/ads.ch index 110259d1d9..91f7e94123 100644 --- a/harbour/contrib/rdd_ads/ads.ch +++ b/harbour/contrib/rdd_ads/ads.ch @@ -99,3 +99,4 @@ #command SET DATE FORMAT [TO] ; => Set( _SET_DATEFORMAT, ); AdsSetDateFormat( ) +#command COMMIT => AdsWriteAllRecords() diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index bb5e74d967..751150c1d5 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -98,7 +98,7 @@ static void DumpArea( ADSAREAP pArea ) /* For debugging: call this to dump ads { UNSIGNED8 pucTemp[1025]; UNSIGNED16 pusLen = 1024; - UNSIGNED32 ulRetVal = 0, ulRetAOF = 0, ulRetFilt = 0; + UNSIGNED32 ulRetVal, ulRetAOF, ulRetFilt; UNSIGNED8 pucFormat[16]; UNSIGNED8 pucFilter[1025]; UNSIGNED8 aucBuffer[MAX_STR_LEN + 1]; @@ -459,7 +459,7 @@ static ERRCODE adsGoToId( ADSAREAP pArea, PHB_ITEM pItem ) static ERRCODE adsGoTop( ADSAREAP pArea ) { - UNSIGNED32 ulRetVal = 0; + UNSIGNED32 ulRetVal; HB_TRACE(HB_TR_DEBUG, ("adsGoTop(%p)", pArea)); pArea->fTop = TRUE; @@ -699,7 +699,7 @@ static ERRCODE adsFlush( ADSAREAP pArea ) HB_SYMBOL_UNUSED( pArea ); HB_TRACE(HB_TR_DEBUG, ("adsFlush(%p)", pArea )); - AdsWriteAllRecords(); + AdsWriteRecord( pArea->hTable ); return SUCCESS; } @@ -1568,7 +1568,8 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde aucBuffer[0] = 0; - if( pOrderInfo->itmOrder && !HB_IS_NIL(pOrderInfo->itmOrder) ) + /* all others need an index handle */ + if( uiIndex != DBOI_ORDERCOUNT && pOrderInfo->itmOrder && !HB_IS_NIL(pOrderInfo->itmOrder) ) { if( HB_IS_NUMERIC( pOrderInfo->itmOrder ) ) ulRetVal = AdsGetIndexHandleByOrder( pArea->hTable, @@ -1576,6 +1577,7 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde else if( HB_IS_STRING( pOrderInfo->itmOrder ) ) ulRetVal = AdsGetIndexHandle( pArea->hTable, (UNSIGNED8*) hb_itemGetCPtr( pOrderInfo->itmOrder ), &phIndex ); + if( ulRetVal != AE_SUCCESS ) return FAILURE; } diff --git a/harbour/contrib/rdd_ads/adsfunc.c b/harbour/contrib/rdd_ads/adsfunc.c index 2a1dd0e3c1..f6ed6cc7e1 100644 --- a/harbour/contrib/rdd_ads/adsfunc.c +++ b/harbour/contrib/rdd_ads/adsfunc.c @@ -870,6 +870,11 @@ HB_FUNC( ADSCLOSEALLTABLES ) hb_retnl( AdsCloseAllTables() ); } +HB_FUNC( ADSWRITEALLRECORDS ) +{ + hb_retnl( AdsWriteAllRecords() ); +} + HB_FUNC( ADSCOPYTABLE ) { ADSAREAP pArea; @@ -1010,3 +1015,16 @@ HB_FUNC( ADSISEXPRVALID ) /* cExpr */ hb_retl(bValidExpr); } +HB_FUNC( ADSGETNUMINDEXES ) /* cExpr */ +{ + ADSAREAP pArea; + UNSIGNED16 pusCnt = 0; + + pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); + if(pArea ) + AdsGetNumIndexes( pArea->hTable, &pusCnt ); + + hb_retni(pusCnt); +} + + diff --git a/harbour/contrib/rdd_ads/doc/en/readme.txt b/harbour/contrib/rdd_ads/doc/en/readme.txt index efd1d42ae9..6f7b643f17 100644 --- a/harbour/contrib/rdd_ads/doc/en/readme.txt +++ b/harbour/contrib/rdd_ads/doc/en/readme.txt @@ -74,14 +74,10 @@ * ACE will always automatically open an index with the same * name as the data file. There is no way to turn this feature off. - * A COMMIT command or dbCommit() call will commit ALL changes in - * ALL workareas. ADS does not have a "commit just this table" call. - * Use dbSkip(0) to commit changes to the current record. - * Be sure to use the command SET DEFAULT TO (cDir) and not its * equivalent Set() function call. The Set() function will not make * the call to ADS to change its internal setting, but the command - * will. + * will. The same is true for DATEFORMAT, DELETE, and EPOCH. * For programmers who are already familiar with the * ACE engine, this also means there are some differences diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index d20a296416..16da804992 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -2431,28 +2431,28 @@ HB_FUNC( ORDLISTADD ) { DBORDERINFO pOrderInfo; - BOOL bFirst = FALSE; + BOOL bFirst; if( s_pCurrArea ) { /* determine if there are existing orders; if not, this becomes the controlling order */ - + pOrderInfo.atomBagName = NULL; pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); SELF_ORDINFO( ( AREAP ) s_pCurrArea->pArea, DBOI_ORDERCOUNT, &pOrderInfo ); bFirst = ( pOrderInfo.itmResult->type & HB_IT_NUMERIC ) && - hb_itemGetNI( &pOrderInfo.itmResult ) != 0; - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemGetNI( pOrderInfo.itmResult ) == 0; pOrderInfo.atomBagName = hb_param( 1, HB_IT_STRING ); - pOrderInfo.itmOrder = hb_param( 2, HB_IT_STRING ); + pOrderInfo.itmOrder = hb_param( 2, HB_IT_STRING ); if( !pOrderInfo.atomBagName ) { hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, "ORDLISTADD" ); return; } SELF_ORDLSTADD( ( AREAP ) s_pCurrArea->pArea, &pOrderInfo ); + hb_itemRelease( pOrderInfo.itmResult ); if ( bFirst ) /* set as controlling order and go top */ { pOrderInfo.itmOrder = hb_itemPutNI( NULL, 1 );