From 6cb1bc6211aec538d95c5699836172ebb31d4cd0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 16 May 2008 07:42:37 +0000 Subject: [PATCH] 2008-05-16 09:30 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * source/rtl/tbrowse.prg + HIDDEN -> PROTECTED * contrib/rddads/rddads.h * Comment. * contrib/rddads/adsfunc.c ! ADSCOPYTABLECONTENTS() fixed to throw an RTE if destination area is not ADS. ! ADSCOPYTABLECONTENTS() fixed to not change the current workarea to the destination area (even if destination area wasn't ADS). * contrib/rddads/ads1.c ! Added some missing bits to VFP support. Requires ACE 9.00 or upper. --- harbour/ChangeLog | 18 +++++++ harbour/contrib/rddads/ads1.c | 36 ++++++++++++-- harbour/contrib/rddads/adsfunc.c | 84 +++++++++++++++----------------- harbour/contrib/rddads/rddads.h | 6 +-- harbour/source/rtl/tbrowse.prg | 4 +- 5 files changed, 94 insertions(+), 54 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index eec84f84c3..65b0b765e5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,24 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-05-16 09:30 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * source/rtl/tbrowse.prg + + HIDDEN -> PROTECTED + + * contrib/rddads/rddads.h + * Comment. + + * contrib/rddads/adsfunc.c + ! ADSCOPYTABLECONTENTS() fixed to throw an RTE if + destination area is not ADS. + ! ADSCOPYTABLECONTENTS() fixed to not change the + current workarea to the destination area + (even if destination area wasn't ADS). + + * contrib/rddads/ads1.c + ! Added some missing bits to VFP support. + Requires ACE 9.00 or upper. + 2008-05-15 17:58 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/gtwvg/gtwvg.c * harbour/source/rtl/gtwvt/gtwvt.c diff --git a/harbour/contrib/rddads/ads1.c b/harbour/contrib/rddads/ads1.c index 2bfe2c7d68..defb36afd3 100644 --- a/harbour/contrib/rddads/ads1.c +++ b/harbour/contrib/rddads/ads1.c @@ -3397,8 +3397,13 @@ static ERRCODE adsSetRel( ADSAREAP pArea, LPDBRELINFO lpdbRelations ) szExp = ( UNSIGNED8 * ) hb_itemGetCPtr( lpdbRelations->abKey ); rddID = lpdbRelations->lpaChild->rddID; - if( *szExp && ( rddID == s_uiRddIdADS || rddID == s_uiRddIdADT || - rddID == s_uiRddIdADSNTX || rddID == s_uiRddIdADSCDX ) ) + if( *szExp && ( rddID == s_uiRddIdADS || + rddID == s_uiRddIdADT || +#if ADS_LIB_VERSION >= 900 + rddID == s_uiRddIdADSVFP || +#endif + rddID == s_uiRddIdADSNTX || + rddID == s_uiRddIdADSCDX ) ) { ADSHANDLE hIndex = ( ( ADSAREAP ) lpdbRelations->lpaChild )->hOrdCurrent; @@ -4940,6 +4945,17 @@ HB_FUNC_STATIC( ADSCDX_GETFUNCTABLE ) adsRegisterRDD( &s_uiRddIdADSCDX ); } +#if ADS_LIB_VERSION >= 900 + +HB_FUNC_STATIC( ADSVFP_GETFUNCTABLE ) +{ + HB_TRACE(HB_TR_DEBUG, ("ADSVFP_GETFUNCTABLE()")); + + adsRegisterRDD( &s_uiRddIdADSVFP ); +} + +#endif + HB_FUNC( ADS ) { ; } #define __PRG_SOURCE__ __FILE__ @@ -4957,6 +4973,9 @@ static void hb_adsRddInit( void * cargo ) if( hb_rddRegister( "ADS", RDT_FULL ) > 1 || hb_rddRegister( "ADT", RDT_FULL ) > 1 || +#if ADS_LIB_VERSION >= 900 + hb_rddRegister( "ADSVFP", RDT_FULL ) > 1 || +#endif hb_rddRegister( "ADSCDX", RDT_FULL ) > 1 || hb_rddRegister( "ADSNTX", RDT_FULL ) > 1 ) { @@ -4968,6 +4987,9 @@ HB_INIT_SYMBOLS_BEGIN( ads1__InitSymbols ) { "ADS", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADS )}, NULL }, { "ADS_GETFUNCTABLE", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADS_GETFUNCTABLE )}, NULL }, { "ADT_GETFUNCTABLE", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADT_GETFUNCTABLE )}, NULL }, +#if ADS_LIB_VERSION >= 900 +{ "ADSVFP_GETFUNCTABLE", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADSVFP_GETFUNCTABLE )}, NULL }, +#endif { "ADSNTX_GETFUNCTABLE", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADSNTX_GETFUNCTABLE )}, NULL }, { "ADSCDX_GETFUNCTABLE", {HB_FS_PUBLIC|HB_FS_LOCAL}, {HB_FUNCNAME( ADSCDX_GETFUNCTABLE )}, NULL } HB_INIT_SYMBOLS_END( ads1__InitSymbols ) @@ -4998,8 +5020,14 @@ ADSAREAP hb_adsGetWorkAreaPointer( void ) if( pArea ) { USHORT rddID = pArea->rddID; - if( rddID == s_uiRddIdADS || rddID == s_uiRddIdADT || - rddID == s_uiRddIdADSNTX || rddID == s_uiRddIdADSCDX ) + + if( rddID == s_uiRddIdADS || + rddID == s_uiRddIdADT || +#if ADS_LIB_VERSION >= 900 + rddID == s_uiRddIdADSVFP || +#endif + rddID == s_uiRddIdADSNTX || + rddID == s_uiRddIdADSCDX ) return pArea; } return NULL; diff --git a/harbour/contrib/rddads/adsfunc.c b/harbour/contrib/rddads/adsfunc.c index fb0feab1a6..626292e8ba 100644 --- a/harbour/contrib/rddads/adsfunc.c +++ b/harbour/contrib/rddads/adsfunc.c @@ -115,7 +115,8 @@ void hb_adsOemAnsiFree( char * pcString ) #endif -HB_FUNC( ADSTESTRECLOCKS ) /* Debug Implicit locks Set/Get call */ +/* Debug Implicit locks Set/Get call */ +HB_FUNC( ADSTESTRECLOCKS ) { hb_retl( hb_ads_bTestRecLocks ); @@ -1305,23 +1306,14 @@ HB_FUNC( ADSISTABLEENCRYPTED ) HB_FUNC( ADSCONNECT ) { - if( ISCHAR( 1 ) ) + ADSHANDLE hConnect = 0; + + if( ISCHAR( 1 ) && + AdsConnect( ( UNSIGNED8 * ) hb_parcx( 1 ), + &hConnect ) == AE_SUCCESS ) { - ADSHANDLE hConnect = 0; - UNSIGNED32 ulRetVal; - - ulRetVal = AdsConnect( ( UNSIGNED8 * ) hb_parcx( 1 ), - &hConnect ); - - if( ulRetVal == AE_SUCCESS ) - { - hb_ads_hConnect = hConnect; - hb_retl( TRUE ); - } - else - { - hb_retl( FALSE ); - } + hb_ads_hConnect = hConnect; + hb_retl( TRUE ); } else { @@ -1331,7 +1323,7 @@ HB_FUNC( ADSCONNECT ) HB_FUNC( ADSDISCONNECT ) { - /* NOTE: From ACE.HLP: + /* NOTE: From ace.hlp: * * AdsDisconnect() is used to disconnect a connection from the specified server. * If tables are currently opened, all data is flushed, locks are released, @@ -1348,25 +1340,15 @@ HB_FUNC( ADSDISCONNECT ) (hConnect might be 0 if caller accidentally disconnects twice; this should not close all connections! */ - if( hConnect != 0 || ISNUM( 1 ) ) + if( ( hConnect != 0 || ISNUM( 1 ) ) && + AdsDisconnect( hConnect ) == AE_SUCCESS ) { - UNSIGNED32 ulRetVal; - - ulRetVal = AdsDisconnect( hConnect ); - - if( ulRetVal == AE_SUCCESS ) + if( hConnect == hb_ads_hConnect ) { - if( hConnect == hb_ads_hConnect ) - { - hb_ads_hConnect = 0; - } + hb_ads_hConnect = 0; + } - hb_retl( TRUE ); - } - else - { - hb_retl( FALSE ); - } + hb_retl( TRUE ); } else { @@ -1399,11 +1381,7 @@ HB_FUNC( ADSCREATESQLSTATEMENT ) } #endif - if( !hb_rddInsertAreaNode( "ADS" ) ) - { - AdsCloseSQLStatement( adsStatementHandle ); - } - else + if( hb_rddInsertAreaNode( "ADS" ) ) { ADSAREAP pArea = hb_adsGetWorkAreaPointer(); @@ -1427,6 +1405,17 @@ HB_FUNC( ADSCREATESQLSTATEMENT ) hb_rddReleaseCurrentArea(); } } +#if 0 + /* QUESTION: Shouldn't we call AdsCloseSQLStatement() if pArea was NULL? [vszakats] */ + else + { + AdsCloseSQLStatement( adsStatementHandle ); + } +#endif + } + else + { + AdsCloseSQLStatement( adsStatementHandle ); } } } @@ -2430,18 +2419,23 @@ HB_FUNC( ADSCOPYTABLECONTENTS ) if( pArea ) { + int iOldArea = hb_rddGetCurrentWorkAreaNumber(); + if( hb_rddSelectWorkAreaAlias( hb_parcx( 1 ) /* szAliasDest */ ) == SUCCESS ) { ADSAREAP pDest = hb_adsGetWorkAreaPointer(); + hb_rddSelectWorkAreaNumber( iOldArea ); + if( pDest ) { - UNSIGNED32 ulRetVal; - - ulRetVal = AdsCopyTableContents( pArea->hTable, - pDest->hTable, - ADS_IGNOREFILTERS ); - hb_retl( ulRetVal == AE_SUCCESS ); + hb_retl( AdsCopyTableContents( pArea->hTable, + pDest->hTable, + ADS_IGNOREFILTERS ) == AE_SUCCESS ); + } + else + { + hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSCOPYTABLECONTENTS" ); } } else diff --git a/harbour/contrib/rddads/rddads.h b/harbour/contrib/rddads/rddads.h index e223553444..af6df90d02 100644 --- a/harbour/contrib/rddads/rddads.h +++ b/harbour/contrib/rddads/rddads.h @@ -81,14 +81,14 @@ #elif defined(ADS_USER_DEFINED) #define _ADS_LIB_VERSION 611 /* or upper */ #else - #define _ADS_LIB_VERSION 500 /* or lower */ + #define _ADS_LIB_VERSION 500 #endif /* Compatibility ACE version override. Usage is discouraged and unnecessary unless we want to override autodetection. For the latter, ADS_LIB_VERSION - is recommended. If ADS_LIB_VERSION is defined, the old - define will be ignored. [vszakats] */ + is recommended. If ADS_LIB_VERSION is #defined, + ADS_REQUIRE_VERSION will be ignored. [vszakats] */ #if !defined( ADS_LIB_VERSION ) #if ADS_REQUIRE_VERSION == 5 #define ADS_LIB_VERSION 500 diff --git a/harbour/source/rtl/tbrowse.prg b/harbour/source/rtl/tbrowse.prg index 3b43358b40..c2f20da927 100644 --- a/harbour/source/rtl/tbrowse.prg +++ b/harbour/source/rtl/tbrowse.prg @@ -124,7 +124,7 @@ CREATE CLASS TBrowse /* === Start of CA-Cl*pper compatible TBrowse instance area === */ VAR cargo AS USUAL EXPORTED // 01. User-definable variable -HIDDEN: +PROTECTED: VAR n_Top AS NUMERIC INIT 0 // 02. Top row number for the TBrowse display VAR n_Left AS NUMERIC INIT 0 // 03. Leftmost column for the TBrowse display VAR n_Bottom AS NUMERIC INIT 0 // 04. Bottom row number for the TBrowse display @@ -262,7 +262,7 @@ EXPORTED: METHOD new( nTop, nLeft, nBottom, nRight ) // constructor, NOTE: This method is a Harbour extension [vszakats] -HIDDEN: +PROTECTED: VAR nRowPos AS INTEGER INIT 1 // current cursor row position VAR nColPos AS INTEGER INIT 1 // current cursor column position VAR nLeftVisible AS INTEGER INIT 0 // indicates position of leftmost unfrozen column in display