2001-03-23 00:45 UTC-0800 Brian Hays <bhays@abacuslaw.com>

This commit is contained in:
Brian Hays
2001-03-23 08:47:32 +00:00
parent f85461b1c1
commit fcb9fc42dc
9 changed files with 698 additions and 27 deletions

View File

@@ -1,3 +1,33 @@
2001-03-23 00:45 UTC-0800 Brian Hays <bhays@abacuslaw.com>
* contrib/rdd_ads/ads1.c
* added unique index creation support
* tweaked SELF_OPEN to return FAILURE only for probable sharing
errors, but throw a real error for everything else.
This way you get the information at runtime for things like
failure to find a server or other useful ADS error#s
* contrib/rdd_ads/adsfunc.c
* minor error handling in ADSGETAOFOPTLEVEL
* source/rdd/dbcmd.c
* fixed handling of fourth IsScoped parameter in dbSetRelation
+ contrib/rdd_ads/adsmgmnt.c
+ added wrappers for most Management functions, including statistics
on connections, comm success rates,
# of open tables/indexes/users, etc.
(( work in progress ))
+ contrib/rdd_ads/testmg.prg
+ simple test for management functions
* contrib/rdd_ads/Makefile
* contrib/rdd_ads/makefile.bc
* contrib/rdd_ads/makefile.vc
* added adsmgmnt.c to build
>>> I only use Borland; someone please check the other make files!
2001-03-22 13:00 UTC-0800 Ron Pinkas <ron@profit-master.com>
* contrib/runjava/runjava.c
+ Added support for Argument Errors

View File

@@ -4,9 +4,10 @@
ROOT = ../../
C_SOURCES=\
ads1.c \
adsfunc.c \
C_SOURCES= \
ads1.c \
adsfunc.c \
adsmgmnt.c \
PRG_SOURCES=\
ads0.prg \

View File

@@ -272,13 +272,11 @@ ERRCODE adsCloseCursor( ADSAREAP pArea )
}
/* Free all filenames */
HB_TRACE(HB_TR_DEBUG, ("adsCloseCursor free buf (%p)", pArea));
if( pArea->szDataFileName )
{
hb_xfree( pArea->szDataFileName );
pArea->szDataFileName = NULL;
}
HB_TRACE(HB_TR_DEBUG, ("adsCloseCursor 3(%p)", pArea));
return uiError;
}
@@ -1166,7 +1164,6 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
{
pArea->szDataFileName = hb_xgrab( strlen(pOpenInfo->abName)+1 );
strcpy( pArea->szDataFileName, ( char * ) pOpenInfo->abName );
//pArea->szDataFileName = ( char * ) pOpenInfo->abName;
pArea->atomAlias = hb_dynsymGet( ( char * ) pOpenInfo->atomAlias );
if( ( ( PHB_DYNS ) pArea->atomAlias )->hArea )
{
@@ -1186,8 +1183,11 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
if( ulRetVal != AE_SUCCESS )
{
// set neterr instead (bh) commonError( pArea, EG_OPEN, ( USHORT ) ulRetVal, ( char * ) pOpenInfo->abName );
return FAILURE;
if ( ulRetVal == 1001 || ulRetVal == 7008) /* 1001 and 7008 are standard ADS Open Errors that will usually be sharing issues */
return FAILURE; /* just set neterr */
else
commonError( pArea, EG_OPEN, ( USHORT ) ulRetVal, ( char * ) pOpenInfo->abName );
}
pArea->hTable = hTable;
pArea->fShared = pOpenInfo->fShared;
@@ -1431,7 +1431,7 @@ static ERRCODE adsOrderListRebuild( ADSAREAP pArea )
static ERRCODE adsOrderCreate( ADSAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
{
ADSHANDLE phIndex;
ADSHANDLE phIndex;
ADSHANDLE hTableOrIndex ;
UNSIGNED32 ulRetVal;
UNSIGNED32 ulOptions = ADS_DEFAULT;
@@ -1486,8 +1486,13 @@ static ERRCODE adsOrderCreate( ADSAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
{
hTableOrIndex = pArea->hTable;
}
if ( pArea->lpdbOrdCondInfo && pArea->lpdbOrdCondInfo->fDescending)
ulOptions |= ADS_DESCENDING;
if ( pArea->lpdbOrdCondInfo )
{
if( pArea->lpdbOrdCondInfo->fDescending )
ulOptions |= ADS_DESCENDING;
}
if ( pOrderInfo->fUnique )
ulOptions |= ADS_UNIQUE;
ulRetVal = AdsCreateIndex( hTableOrIndex, pOrderInfo->abBagName,
pOrderInfo->atomBagName, (UCHAR*)hb_itemGetCPtr( pExprItem ),
@@ -1903,6 +1908,7 @@ static ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo )
static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo )
{
UNSIGNED8 aucKey[ADS_MAX_KEY_LENGTH];
HB_TRACE(HB_TR_DEBUG, ("adsSetScope(%p, %p)", pArea, sInfo));
if( pArea->hOrdCurrent )

View File

@@ -326,7 +326,8 @@ HB_FUNC( ADSGETAOFOPTLEVEL )
if( pArea )
{
AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen );
hb_retni( pusOptLevel );
hb_retni( pusOptLevel > 65000 ? ADS_OPTIMIZED_NONE : pusOptLevel );
/* If no aof, returns 65,353 */
}
else
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSGETAOFOPTLEVEL" );

View File

@@ -0,0 +1,431 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Advantage Database Server RDD ( Management functions )
*
* Copyright 2001 Brian Hays <bhays@abacuslaw.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) with other files to produce
* an executable, this does not by itself cause the resulting executable
* to be covered by the GNU General Public License. Your use of that
* executable is in no way restricted on account of linking the HRL
* and/or HVM code into it.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#define HB_OS_WIN_32_USED
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbinit.h"
#include "hbvm.h"
#include "rddsys.ch"
#include "hbapilng.h"
#include "hbdate.h"
#include "hbapierr.h"
#include "rddads.h"
/*
Advantage Managment API Examples
*/
ADSHANDLE hMgmtHandle = 0;
HB_FUNC( ADSMGCONNECT )
{
/* ulRetVal = AdsMgConnect( "\\\\server\\volume:", NULL, NULL, &hMgmtHandle );
// UNSIGNED32 ENTRYPOINT AdsMgConnect( UNSIGNED8 *pucServerName,
// UNSIGNED8 *pucUserName,
// UNSIGNED8 *pucPassword,
// ADSHANDLE *phMgmtHandle );
*/
hb_retnl( AdsMgConnect( hb_parc(1), hb_parc(2), hb_parc(3), &hMgmtHandle) );
}
HB_FUNC( ADSMGDISCONNECT )
{
hb_retnl( AdsMgDisconnect( hMgmtHandle ) );
hMgmtHandle = 0;
}
HB_FUNC( ADSMGGETINSTALLINFO )
{
UNSIGNED32 ulRetVal;
UNSIGNED16 usStructSize;
ADS_MGMT_INSTALL_INFO stInstallInfo;
usStructSize = sizeof( ADS_MGMT_INSTALL_INFO );
ulRetVal = AdsMgGetInstallInfo( hMgmtHandle, &stInstallInfo, &usStructSize );
//if ( sizeof( ADS_MGMT_INSTALL_INFO ) < usStructSize )
// printf( "\nInstallation Information structure on server is larger." );
// printf( "\nMore possible info available." );
if ( ulRetVal == AE_SUCCESS )
{
hb_reta( 8 );
hb_stornl( stInstallInfo.ulUserOption , -1, 1 ); /* User option purchased*/
hb_storc ( stInstallInfo.aucRegisteredOwner,-1, 2 ); /* Registered owner */
hb_storc ( stInstallInfo.aucVersionStr , -1, 3 ); /* Advantage version */
hb_storc ( stInstallInfo.aucInstallDate , -1, 4 ); /* Install date string */
hb_storc ( stInstallInfo.aucOemCharName , -1, 5 ); /* OEM char language */
hb_storc ( stInstallInfo.aucAnsiCharName , -1, 6 ); /* ANSI char language */
hb_storc ( stInstallInfo.aucEvalExpireDate, -1, 7 ); /* Eval expiration date */
hb_storc ( stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */
}
else
hb_ret( );
}
HB_FUNC( ADSMGGETACTIVITYINFO )
{
UNSIGNED32 ulRetVal;
UNSIGNED16 usStructSize;
ADS_MGMT_ACTIVITY_INFO stActivityInfo;
UINT iOption = hb_parni( 1 );
usStructSize = sizeof( ADS_MGMT_ACTIVITY_INFO );
ulRetVal = AdsMgGetActivityInfo( hMgmtHandle, &stActivityInfo, &usStructSize );
// if ( sizeof( ADS_MGMT_ACTIVITY_INFO ) < usStructSize )
// printf( "\nActivity Information structure on server is larger." );
// printf( "\nMore possible info available." );
hb_ret(); /* default to NIL */
if ( iOption && ulRetVal == AE_SUCCESS )
{
switch ( iOption )
{
case 1 :
hb_retnl( stActivityInfo.ulOperations ); /* Number operations since started */
break;
case 2 :
hb_retnl( stActivityInfo.ulLoggedErrors ); /* Number logged errors */
break;
case 3 :
hb_reta( 4 ); /* Length of time ADS has been up */
hb_stornl( stActivityInfo.stUpTime.usDays, -1, 1 );
hb_stornl( stActivityInfo.stUpTime.usHours, -1, 2 );
hb_stornl( stActivityInfo.stUpTime.usMinutes, -1, 3 );
hb_stornl( stActivityInfo.stUpTime.usSeconds, -1, 4 );
break;
case 4 :
hb_reta( 3 ); /* Users in use, max, rejected */
hb_stornl( stActivityInfo.stUsers.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stUsers.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stUsers.ulRejected, -1, 3 );
break;
case 5 :
hb_reta( 3 ); /* Conns in use, max, rejected */
hb_stornl( stActivityInfo.stConnections.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stConnections.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stConnections.ulRejected, -1, 3 );
break;
case 6 :
hb_reta( 3 ); /* WAs in use, max, rejected */
hb_stornl( stActivityInfo.stWorkAreas.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stWorkAreas.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stWorkAreas.ulRejected, -1, 3 );
break;
case 7 :
hb_reta( 3 ); /* Tables in use, max, rejected */
hb_stornl( stActivityInfo.stTables.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stTables.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stTables.ulRejected, -1, 3 );
break;
case 8 :
hb_reta( 3 ); /* Indexes in use, max, rejected */
hb_stornl( stActivityInfo.stIndexes.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stIndexes.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stIndexes.ulRejected, -1, 3 );
break;
case 9 :
hb_reta( 3 ); /* Locks in use, max, rejected */
hb_stornl( stActivityInfo.stLocks.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stLocks.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stLocks.ulRejected, -1, 3 );
break;
case 10 :
hb_reta( 3 ); /* TPS header elems in use, max */
hb_stornl( stActivityInfo.stTpsHeaderElems.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stTpsHeaderElems.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stTpsHeaderElems.ulRejected, -1, 3 );
break;
case 11 :
hb_reta( 3 ); /* TPS vis elems in use, max */
hb_stornl( stActivityInfo.stTpsVisElems.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stTpsVisElems.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stTpsVisElems.ulRejected, -1, 3 );
break;
case 12 :
hb_reta( 3 ); /* TPS memo elems in use, max */
hb_stornl( stActivityInfo.stTpsMemoElems.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stTpsMemoElems.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stTpsMemoElems.ulRejected, -1, 3 );
break;
case 13 :
hb_reta( 3 ); /* Worker threads in use, max */
hb_stornl( stActivityInfo.stWorkerThreads.ulInUse, -1, 1 );
hb_stornl( stActivityInfo.stWorkerThreads.ulMaxUsed, -1, 2 );
hb_stornl( stActivityInfo.stWorkerThreads.ulRejected, -1, 3 );
break;
}
}
}
HB_FUNC( ADSMGGETCOMMSTATS )
{
UNSIGNED32 ulRetVal ;
UNSIGNED16 usStructSize;
ADS_MGMT_COMM_STATS stCommStats;
usStructSize = sizeof( ADS_MGMT_COMM_STATS );
ulRetVal = AdsMgGetCommStats( hMgmtHandle, &stCommStats, &usStructSize );
// if ( sizeof( ADS_MGMT_COMM_STATS ) < usStructSize )
// {
// HB_TRACE(HB_TR_INFO, ("The Communication Statistics structure on the server is larger.
// \nMore info is available with the current ACE.H." ));
// }
if ( ulRetVal == AE_SUCCESS )
{
hb_reta( 11 );
hb_stornd( stCommStats.dPercentCheckSums, -1, 1 ); /* % of pkts with checksum failures */
hb_stornl( stCommStats.ulTotalPackets, -1, 2 ); /* Total packets received */
hb_stornl( stCommStats.ulRcvPktOutOfSeq , -1, 3 ); /* Receive packets out of sequence */
hb_stornl( stCommStats.ulNotLoggedIn , -1, 4 ); /* Packet owner not logged in */
hb_stornl( stCommStats.ulRcvReqOutOfSeq , -1, 5 ); /* Receive requests out of sequence */
hb_stornl( stCommStats.ulCheckSumFailures, -1, 6 ); /* Checksum failures */
hb_stornl( stCommStats.ulDisconnectedUsers,-1, 7 ); /* Server initiated disconnects */
hb_stornl( stCommStats.ulPartialConnects , -1, 8 ); /* Removed partial connections */
hb_stornl( stCommStats.ulInvalidPackets , -1, 9 ); /* Rcvd invalid packets (NT only) */
hb_stornl( stCommStats.ulRecvFromErrors , -1, 10); /* RecvFrom failed (NT only) */
hb_stornl( stCommStats.ulSendToErrors , -1, 11); /* SendTo failed (NT only) */
}
else
hb_ret( );
}
HB_FUNC( ADSMGRESETCOMMSTATS )
{
if ( hMgmtHandle )
hb_retnl( AdsMgResetCommStats( hMgmtHandle ) );
else
hb_retnl( -1 );
}
HB_FUNC( ADSMGGETCONFIGINFO )
{
UNSIGNED32 ulRetVal ;
ADS_MGMT_CONFIG_PARAMS stConfigValues;
ADS_MGMT_CONFIG_MEMORY stConfigMemory;
UNSIGNED16 usConfigValuesStructSize;
UNSIGNED16 usConfigMemoryStructSize;
int iOption = ISNUM(1) ? hb_parni(1) : 1 ; /* Pass 0 for Values, 1 for memory */
usConfigValuesStructSize = sizeof( ADS_MGMT_CONFIG_PARAMS );
usConfigMemoryStructSize = sizeof( ADS_MGMT_CONFIG_MEMORY );
usConfigValuesStructSize = sizeof( ADS_MGMT_CONFIG_PARAMS );
usConfigMemoryStructSize = sizeof( ADS_MGMT_CONFIG_MEMORY );
ulRetVal = AdsMgGetConfigInfo( hMgmtHandle, &stConfigValues,
&usConfigValuesStructSize,
&stConfigMemory, &usConfigMemoryStructSize );
// if ( sizeof( ADS_MGMT_CONFIG_PARAMS ) < usConfigValuesStructSize )
// printf( "\nConfiguration Values structure on server is larger." );
// if ( sizeof( ADS_MGMT_CONFIG_MEMORY ) < usConfigMemoryStructSize )
// printf( "\nConfiguration Memory structure on server is larger." );
if ( ulRetVal == AE_SUCCESS )
{
if ( iOption == 0 )
{
hb_reta( 26 );
hb_stornl( stConfigValues.ulNumConnections , -1, 1 ); /* number connections */
hb_stornl( stConfigValues.ulNumWorkAreas , -1, 2 ); /* number work areas */
hb_stornl( stConfigValues.ulNumTables , -1, 3 ); /* number tables */
hb_stornl( stConfigValues.ulNumIndexes , -1, 4 ); /* number indexes */
hb_stornl( stConfigValues.ulNumLocks , -1, 5 ); /* number locks */
hb_stornl( stConfigValues.ulUserBufferSize , -1, 6 ); /* user buffer */
hb_stornl( stConfigValues.ulStatDumpInterval , -1, 7 ); /* statistics dump interval */
hb_stornl( stConfigValues.ulErrorLogMax , -1, 8 ); /* max size of error log */
hb_stornl( stConfigValues.ulNumTPSHeaderElems , -1, 9 ); /* number TPS header elems */
hb_stornl( stConfigValues.ulNumTPSVisibilityElems,-1, 10); /* number TPS vis elems */
hb_stornl( stConfigValues.ulNumTPSMemoTransElems, -1, 11); /* number TPS memo elems */
hb_stornl( stConfigValues.usNumReceiveECBs , -1, 12); /* number rcv ECBs (NLM only) */
hb_stornl( stConfigValues.usNumSendECBs , -1, 13); /* number send ECBs (NLM only) */
hb_stornd( stConfigValues.usNumBurstPackets , -1, 14); /* number packets per burst */
hb_stornl( stConfigValues.usNumWorkerThreads , -1, 15); /* number worker threads */
hb_stornl( stConfigValues.usSortBuffSize , -1, 16); /* index sort buffer size */
hb_storni( stConfigValues.ucReserved1 , -1, 17); /* reserved */
hb_storni( stConfigValues.ucReserved2 , -1, 18); /* reserved */
hb_storc ( stConfigValues.aucErrorLog , -1, 19); /* error log path */
hb_storc ( stConfigValues.aucSemaphore , -1, 20); /* semaphore file path */
hb_storc ( stConfigValues.aucTransaction , -1, 21); /* TPS log file path */
hb_storni( stConfigValues.ucReserved3 , -1, 22); /* reserved */
hb_storni( stConfigValues.ucReserved4 , -1, 23); /* reserved */
hb_stornl( stConfigValues.usSendIPPort , -1, 24); /* NT Service IP send port # */
hb_stornl( stConfigValues.usReceiveIPPort , -1, 25); /* NT Service IP rcv port # */
hb_stornl( stConfigValues.usReserved5 , -1, 26); /* reserved */
}else
if ( iOption == 1 )
{
hb_reta( 13 );
hb_stornd( stConfigMemory.ulTotalConfigMem , -1, 1 ); /* Total mem taken by cfg params */
hb_stornl( stConfigMemory.ulConnectionMem , -1, 2 ); /* memory taken by connections */
hb_stornl( stConfigMemory.ulWorkAreaMem , -1, 3 ); /* memory taken by work areas */
hb_stornl( stConfigMemory.ulTableMem , -1, 4 ); /* memory taken by tables */
hb_stornl( stConfigMemory.ulIndexMem , -1, 5 ); /* memory taken by indexes */
hb_stornl( stConfigMemory.ulLockMem , -1, 6 ); /* memory taken by locks */
hb_stornl( stConfigMemory.ulUserBufferMem , -1, 7 ); /* memory taken by user buffer */
hb_stornl( stConfigMemory.ulTPSHeaderElemMem , -1, 8 ); /* memory taken by TPS hdr elems */
hb_stornl( stConfigMemory.ulTPSVisibilityElemMem, -1, 9 ); /* memory taken by TPS vis elems */
hb_stornl( stConfigMemory.ulTPSMemoTransElemMem , -1, 10); /* mem taken by TPS memo elems */
hb_stornl( stConfigMemory.ulReceiveEcbMem , -1, 11); /* mem taken by rcv ECBs (NLM) */
hb_stornl( stConfigMemory.ulSendEcbMem , -1, 12); /* mem taken by send ECBs (NLM) */
hb_stornl( stConfigMemory.ulWorkerThreadMem , -1, 13); /* mem taken by worker threads */
}
}
else
hb_ret( );
}
HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */
{
UNSIGNED32 ulRetVal ;
UNSIGNED32 ulMaxUsers = 100 ; /* needed for array memory allocation; caller can set with 2nd arg */
UNSIGNED32 ulCount;
UNSIGNED16 usStructSize = sizeof( ADS_MGMT_USER_INFO );
ADS_MGMT_USER_INFO* pastUserInfo;
// ADS_MGMT_USER_INFO astUserInfo[MAX_NUM_USERS];
if ( ISNUM( 2 ) )
ulMaxUsers = hb_parnl( 2 );
pastUserInfo = hb_xgrab( sizeof( ADS_MGMT_USER_INFO ) * ulMaxUsers );
// AdsMgGetUserNames ( ADSHANDLE hMgmtConnect,
// UNSIGNED8 *pucFileName,
// ADS_MGMT_USER_INFO astUserInfo[],
// UNSIGNED16 *pusArrayLen,
// UNSIGNED16 *pusStructSize );
ulRetVal = AdsMgGetUserNames( hMgmtHandle, ISCHAR( 1 ) ? hb_parc( 1 ) : NULL,
pastUserInfo,
&ulMaxUsers,
&usStructSize );
//if ( sizeof( ADS_MGMT_USER_INFO ) < usStructSize )
// {
// HB_TRACE(HB_TR_INFO, ("The \nUser Information structure on the server is larger.
// \nMore info is available with the current ACE.H." ));
// }
if ( ulRetVal == AE_SUCCESS )
{
hb_reta( ulMaxUsers );
for ( ulCount = 0; ulCount < ulMaxUsers; ulCount++ )
{
hb_storc ( pastUserInfo[ulCount].aucUserName , -1, ulCount+1);
}
}else
hb_reta( 0 );
hb_xfree( pastUserInfo );
}
/*
HB_FUNC( ADSMGGETOPENTABLES )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetOpenTables();
}
HB_FUNC( ADSMGGETOPENINDEXES )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetOpenIndexes();
}
HB_FUNC( ADSMGGETLOCKS )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetLocks();
}
HB_FUNC( ADSMGGETSERVERTYPE )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetServerType();
}
HB_FUNC( ADSMGGETWORKERTHREADACTIVITY )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetWorkerThreadActivity();
}
HB_FUNC( ADSMGGETLOCKOWNER )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgGetLockOwner();
}
HB_FUNC( ADSMGKILLUSER )
{
UNSIGNED32 ulRetVal = AE_SUCCESS;
AdsMgKillUser();
}
*/

View File

@@ -11,15 +11,17 @@ BIN_DIR = ..\..\bin\b32
OBJ_DIR = ..\..\obj\b32
LIB_DIR = ..\..\lib\b32
$(LIB_DIR)\rddads.lib : \
$(OBJ_DIR)\ads0.obj \
$(OBJ_DIR)\ads1.obj \
$(OBJ_DIR)\adsfunc.obj
$(LIB_DIR)\rddads.lib : \
$(OBJ_DIR)\ads0.obj \
$(OBJ_DIR)\ads1.obj \
$(OBJ_DIR)\adsfunc.obj \
$(OBJ_DIR)\adsmgmnt.obj
$(OBJ_DIR)\ads0.c : ads0.prg
$(OBJ_DIR)\ads0.obj : $(OBJ_DIR)\ads0.c
$(OBJ_DIR)\ads1.obj : ads1.c
$(OBJ_DIR)\adsfunc.obj : adsfunc.c
$(OBJ_DIR)\ads0.c : ads0.prg
$(OBJ_DIR)\ads0.obj : $(OBJ_DIR)\ads0.c
$(OBJ_DIR)\ads1.obj : ads1.c
$(OBJ_DIR)\adsfunc.obj : adsfunc.c
$(OBJ_DIR)\adsmgmnt.obj : adsmgmnt.c
.c.obj:
bcc32 $(CLIBFLAGS) -c -O2 -I$(INCLUDE_DIR) -o$@ $<

View File

@@ -33,9 +33,10 @@ HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0
#
ADS_LIB_OBJS = \
$(OBJ_DIR)\ads0.obj \
$(OBJ_DIR)\ads1.obj \
$(OBJ_DIR)\adsfunc.obj
$(OBJ_DIR)\ads0.obj \
$(OBJ_DIR)\ads1.obj \
$(OBJ_DIR)\adsfunc.obj \
$(OBJ_DIR)\adsmgmnt.obj
#
# Our default target
@@ -47,6 +48,7 @@ CLEAN:
-@if exist $(OBJ_DIR)\ads0.obj del $(OBJ_DIR)\ads0.obj
-@if exist $(OBJ_DIR)\ads1.obj del $(OBJ_DIR)\ads1.obj
-@if exist $(OBJ_DIR)\adsfunc.obj del $(OBJ_DIR)\adsfunc.obj
-@if exist $(OBJ_DIR)\adsmgmnt.obj del $(OBJ_DIR)\adsmgmnt.obj
-@if exist $(ADS_LIB) del $(ADS_LIB)
#
@@ -64,6 +66,9 @@ $(OBJ_DIR)\ads0.obj : ads0.prg
$(HARBOUR_EXE) $** $(HARBOURFLAGS) -o$*.c
$(CC) $(CLIBFLAGS) -Fo$@ $*.c
$(OBJ_DIR)\adsmgmnt.obj : adsmgmnt.c
$(CC) $(CLIBFLAGS) -Fo$@ $**
$(OBJ_DIR)\adsfunc.obj : adsfunc.c
$(CC) $(CLIBFLAGS) -Fo$@ $**

View File

@@ -0,0 +1,192 @@
#include "ord.ch"
#include "set.ch"
#define USEADS
#ifdef USEADS
#include "Ads.ch"
#else
Request dBfCdx
#endif
function Main()
local i
REQUEST _ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
SET SERVER LOCAL // REMOTE
AdsSetFileType(ADS_CDX)
// use test // make this available to get some stats on open tables below
? "Advantage Database Server Management Functions in Harbour"
?
? "Connect:", AdsMgConnect( 'C:' )
aRay := AdsMgGetInstallInfo()
IF len(aRay) > 7
? "Install info:"
? aRay[1]
? aRay[2]
? aRay[3]
? aRay[4]
? aRay[5]
? aRay[6]
? aRay[7]
? aRay[8]
?
ENDIF
? "Activity info:"
? AdsMgGetActivityInfo(1)
? AdsMgGetActivityInfo(2)
aRay := AdsMgGetActivityInfo(3)
IF len(aRay) > 3
? "Up Time:", aRay[1], aRay[2], aRay[3], aRay[4]
?
ENDIF
? " Item In Use MaxUsed Rejected"
aRay := AdsMgGetActivityInfo(4)
IF len(aRay) > 2
? "Users: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(5)
IF len(aRay) > 2
? "Connections: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(6)
IF len(aRay) > 2
? "WorkAreas: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(7)
IF len(aRay) > 2
? "Tables: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(8)
IF len(aRay) > 2
? "Indexes: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(9)
IF len(aRay) > 2
? "Locks: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(10)
IF len(aRay) > 2
? "TpsHeaderElems:", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(11)
IF len(aRay) > 2
? "TpsVisElems: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(12)
IF len(aRay) > 2
? "TpsMemoElems: ", aRay[1], aRay[2], aRay[3]
ENDIF
aRay := AdsMgGetActivityInfo(13)
IF len(aRay) > 2
? "WorkerThreads: ", aRay[1], aRay[2], aRay[3]
ENDIF
wait
?
aRay := AdsMgGetCommStats()
IF len(aRay) > 10
? aRay[1] , "% of pkts with checksum failures "
? aRay[2] , "Total packets received "
? aRay[3] , "Receive packets out of sequence "
? aRay[4] , "Packet owner not logged in "
? aRay[5] , "Receive requests out of sequence "
? aRay[6] , "Checksum failures "
? aRay[7] , "Server initiated disconnects "
? aRay[8] , "Removed partial connections "
? aRay[9] , "Rcvd invalid packets (NT only) "
? aRay[10], "RecvFrom failed (NT only) "
? aRay[11], "SendTo failed (NT only) "
ENDIF
wait
?
aRay := AdsMgGetConfigInfo(0)
IF len(aRay) > 25
? aRay[1] , " number connections "
? aRay[2] , " number work areas "
? aRay[3] , " number tables "
? aRay[4] , " number indexes "
? aRay[5] , " number locks "
? aRay[6] , " user buffer "
? aRay[7] , " statistics dump interval "
? aRay[8] , " max size of error log "
? aRay[9] , " number TPS header elems "
? aRay[10], " number TPS vis elems "
? aRay[11], " number TPS memo elems "
? aRay[12], " number rcv ECBs (NLM only) "
? aRay[13], " number send ECBs (NLM only) "
? aRay[14], " number packets per burst "
? aRay[15], " number worker threads "
? aRay[16], " index sort buffer size "
? aRay[17], " reserved "
? aRay[18], " reserved "
? aRay[19], " error log path "
? aRay[20], " semaphore file path "
? aRay[21], " TPS log file path "
? aRay[22], " reserved "
? aRay[23], " reserved "
? aRay[24], " NT Service IP send port # "
? aRay[25], " NT Service IP rcv port # "
? aRay[26], " reserved "
ENDIF
wait
?
aRay := AdsMgGetConfigInfo(1)
IF len(aRay) > 12
? aRay[1] , " Total mem taken by cfg params "
? aRay[2] , " memory taken by connections "
? aRay[3] , " memory taken by work areas "
? aRay[4] , " memory taken by tables "
? aRay[5] , " memory taken by indexes "
? aRay[6] , " memory taken by locks "
? aRay[7] , " memory taken by user buffer "
? aRay[8] , " memory taken by TPS hdr elems "
? aRay[9] , " memory taken by TPS vis elems "
? aRay[10], " mem taken by TPS memo elems "
? aRay[11], " mem taken by rcv ECBs (NLM) "
? aRay[12], " mem taken by send ECBs (NLM) "
? aRay[13], " mem taken by worker threads "
ENDIF
?
// First arg: pass in a file name for list of those with that file open
// Second arg: Max # of users (required for memory allocation, default is 100)
aRay := AdsMgGetUserNames()
? "Number of connected users: ", len(aRay)
FOR i := 1 TO len(aRay)
? aRay[i]
NEXT
?
? "Disconnect", AdsMgDisconnect()
?
? "end"
?
return nil

View File

@@ -30,7 +30,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
l *
*
*/
#include <ctype.h>
@@ -2729,7 +2729,7 @@ HB_FUNC( ORDSCOPE )
if( s_pCurrArea )
{
if( !ISNUM( 1 ) || ( !ISNIL( 2 ) && hb_parinfo( 2 ) != HB_IT_STRING ) )
if( !ISNUM( 1 ) || (!ISNIL(2) && !( ISCHAR(2) || ISNUM(2) || ISDATE(2) || ISLOG(2) )))
{
hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, "ORDSCOPE" );
return;
@@ -2746,7 +2746,10 @@ HB_FUNC( ORDSCOPE )
if ( ISNIL( 2 ) ) /* explicitly passed NIL, clear it */
sInfo.scopeValue = NULL;
else
sInfo.scopeValue = (BYTE*) hb_parc( 2 );
sInfo.scopeValue = (BYTE*) (ISCHAR( 2 ) ? hb_parc( 2 ) :
(ISDATE( 2 ) ? hb_pards( 2 ) : hb_parc( 2 ) ) ) ;
/* this is a temp fix until we decide if the item should be passed down or "parsed" here */
SELF_SETSCOPE( ( AREAP ) s_pCurrArea->pArea, (LPDBORDSCOPEINFO) &sInfo );
}else
@@ -2796,7 +2799,7 @@ HB_FUNC( DBSETRELATION )
if( hb_pcount() < 2 || ( !( hb_parinfo( 1 ) & HB_IT_NUMERIC ) &&
( hb_parinfo( 1 ) != HB_IT_STRING ) ) ||
( hb_pcount() > 3 && !( hb_parinfo( 4 ) & HB_IT_LOGICAL ) ) )
!( ISNIL( 4 ) || ISLOG( 4 ) ) )
{
hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, "DBSETRELATION" );
return;