From 65ef23e4059128f60c08fe9f7f551c9944ef6efb Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 12 Feb 2007 15:52:52 +0000 Subject: [PATCH] 2007-02-12 16:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/rdd_ads/ads1.c * do not release FLOCK() after DBAPPEND() - only RLOCKs should be removed * harbour/contrib/rdd_ads/rddads.h * set ADS_REQUIRE_VERSION when not set by user scripts --- harbour/ChangeLog | 7 +++++++ harbour/contrib/rdd_ads/ads1.c | 35 +++++++++++++++++--------------- harbour/contrib/rdd_ads/rddads.h | 9 +++++++- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 06301e370e..2a28e41374 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-02-12 16:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/rdd_ads/ads1.c + * do not release FLOCK() after DBAPPEND() - only RLOCKs should be + removed + * harbour/contrib/rdd_ads/rddads.h + * set ADS_REQUIRE_VERSION when not set by user scripts + 2007-02-12 10:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/pp/ppcore.c ! fix line numbering when preprocess static buffers, f.e. by diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index cb979c5245..a4e28ef109 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -1294,7 +1294,7 @@ static ERRCODE adsAppend( ADSAREAP pArea, BOOL fUnLockAll ) AdsAtEOF( pArea->hTable, &u16Eof ); } - if( fUnLockAll ) + if( fUnLockAll && pArea->fShared && !pArea->fFLocked ) { SELF_RAWLOCK( ( AREAP ) pArea, FILE_UNLOCK, 0 ); } @@ -1302,22 +1302,25 @@ static ERRCODE adsAppend( ADSAREAP pArea, BOOL fUnLockAll ) u32RetVal = AdsAppendRecord( pArea->hTable ); if( u32RetVal == AE_SUCCESS ) { - ULONG ulRecNo; - /* - * Brian, please ask about it ExtSys guys. - * Does it create race condition (the implicit lock is removed - * and then the explicit one set) or just simply the flag indicating - * lock type is changed only. We have to know that. - * Without explicit locking the lock on appended record will be - * removed on any record movement or flushing. It may cause very - * serious synchronization problems in programs written for other - * RDDs and then ported to ADS. Druzus. - */ - if( SELF_RECNO( ( AREAP ) pArea, &ulRecNo ) == SUCCESS ) + if( pArea->fShared && !pArea->fFLocked ) { - /* to avoid unnecessary record refreshing after locking */ - pArea->fPositioned = TRUE; - SELF_RAWLOCK( ( AREAP ) pArea, REC_LOCK, ulRecNo ); + ULONG ulRecNo; + /* + * Brian, please ask about it ExtSys guys. + * Does it create race condition (the implicit lock is removed + * and then the explicit one set) or just simply the flag indicating + * lock type is changed only. We have to know that. + * Without explicit locking the lock on appended record will be + * removed on any record movement or flushing. It may cause very + * serious synchronization problems in programs written for other + * RDDs and then ported to ADS. Druzus. + */ + if( SELF_RECNO( ( AREAP ) pArea, &ulRecNo ) == SUCCESS ) + { + /* to avoid unnecessary record refreshing after locking */ + pArea->fPositioned = TRUE; + SELF_RAWLOCK( ( AREAP ) pArea, REC_LOCK, ulRecNo ); + } } pArea->fBof = FALSE; pArea->fEof = FALSE; diff --git a/harbour/contrib/rdd_ads/rddads.h b/harbour/contrib/rdd_ads/rddads.h index 984fc94f1d..d454c75c00 100644 --- a/harbour/contrib/rdd_ads/rddads.h +++ b/harbour/contrib/rdd_ads/rddads.h @@ -51,7 +51,7 @@ */ #ifndef ADS_REQUIRE_VERSION -/*#define ADS_REQUIRE_VERSION 6*/ + #define ADS_REQUIRE_VERSION 5 #endif #include "hbapirdd.h" @@ -60,6 +60,13 @@ #endif #include "ace.h" +#undef ADS_MAX_KEY_LENGTH +#if ADS_REQUIRE_VERSION >= 8 + #define ADS_MAX_KEY_LENGTH 4082 /* maximum key value length. This is the max key length */ +#else /* of ADI indexes. Max CDX key length is 240. Max */ + #define ADS_MAX_KEY_LENGTH 256 /* NTX key length is 256 */ +#endif + HB_EXTERN_BEGIN