Skip to content

3. Functions#

This chapter discusses Altibase Monitoring API functions. The following information is provided:

  • Function Name
  • Syntax: Function Prototype in C
  • Arguments: Data Type, Input/Output, Description
  • Return Values
  • Description: Usage and Considerations
  • Examples

ABIInitialize#

Syntax#

int ABIInitialize ( void );

Return Values#

If successful, returns 0; otherwise, returns an error code.

Description#

This function needs to be initially invoked to use Altibase Monitoring API. It performs initialization operations such as setting the connection to the Altibase server.

Example#

if( ABIInitialize( ) != 0 )
{
    /* ... error handling ... */
}

ABIFinalize#

Syntax#

int ABIFinalize ( void );

Return Values#

If successful, returns 0; otherwise, returns an error code.

Description#

This function needs to be invoked to close Altibase Monitoring API. It performs operations such as freeing memory that has been allocated while using Altibase Monitoring API and disconnecting from the Altibase server.

Example#

if( ABIFinalize( ) != 0 )
{
    /* ... error handling ... */
}

ABISetProperty#

Syntax#

int ABISetProperty (
    ABIPropType         aPropType,
    const char          *aPropValue );

Arguments#

Data Type Argument In/Output Description
ABIPropType aPropType Input Specifies the name of the property to be set. One of the following can be used: ABI_USER, ABI_PASSWD, ABI_LOGFILE
const char * aPropValue Input Value of the property to be set

Return Values#

If successful, returns 0; otherwise, returns an error code.

Description#

This function specifies the user name and user password to connect to the Altibase server, and the log file path. On omission, the default values are SYS, MANAGER, and altibaseMonitor.log, respectively.

Error messages that occur in Altibase Monitoring API are written to log files. If the path is omitted and only the file name is specified, a log file is created in the path wherein the application runs.

Example#

if( ABISetProperty( ABI_USER, "SYS" ) != 0 )
{
    /* ... error handling ... */
}

ABICheckConnection#

Syntax#

int ABICheckConnection ( );

Return Values#

If the connection status is normal, returns 0; otherwise, returns -1.

Description#

This function checks the connection between the Altibase server and Altibase Monitoring API.

Example#

if( ABICheckConnection( ) != -1 )
{
    /* Select performance view */
}
else
{
    /* ... error handling ... */
}

ABIGetVSession#

Syntax#

int ABIGetVSession (
    ABIVSession          **aHandle,
    unsigned int         aExecutingOnly );

Arguments#

Data Type Argument In/Output Description
ABIVSession** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
unsigned int aExecutingOnly Input 0: Select all session
1: Selects only active sessions

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SESSION performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSession type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_1.c for an application related to this function.

ABIVSession *sVSession;
ABIVSession *sVSessionActiveOnly;
int sRowCount;
int sRowCountActiveOnly;

/* Select all sessions */
sRowCount = ABIGetVSession(  &sVSession, 0 );

/* Select only active sessions */
sRowCountActiveOnly = ABIGetVSession( &sVSessionActiveOnly, 1 );

ABIGetVSessionBySID#

Syntax#

int ABIGetVSessionBySID (
    ABIVSession          **aHandle,
    int                  aSessionID );

Arguments#

Data Type Argument In/Output Description
ABIVSession** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
int aSessionID Input The session ID to be selected

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SESSION performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSession type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_1.c for an application related to this function.

ABIVSession *sVSession;
int sRowCount;

sRowCount = ABIGetVSessionBySID(  &sVSession, 1 );

ABIGetVSysstat#

Syntax#

int ABIGetVSysstat (
    ABIVSysstat          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIVSysstat ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SYSSTAT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSysstat type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_3.c for an application related to this function.

ABIVSysstat *sVSysstat;
int sRowCount;

sRowCount = ABIGetVSysstat( &sVSysstat );

ABIGetVSesstat#

Syntax#

int ABIGetVSesstat (
    ABIVSesstat          **aHandle,
    unsigned int         aExecutingOnly );

Arguments#

Data Type Argument In/Output Description
ABIVSesstat ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
unsigned int aExecutingOnly Input 0: Selects all sessions
1: Selects only active sessions

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SESSTAT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSesstat type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_3.c for an applicaiton related to this function.

ABIVSesstat *sVSesstat;
int sRowCount;

sRowCount = ABIGetVSesstat( &sVSesstat );

ABIGetVSesstatBySID#

Syntax#

int ABIGetVSesstatBySID (
    ABIVSesstat          **aHandle,
    int                  aSessionID );

Arguments#

Data Type Argument In/Output Description
ABIVSesstat ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
int aSessionID 입력 The session ID to be selected

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects statistics about a certain session from the V$SESSTAT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSesstat type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_3.c for an application related to this function.

ABIVSesstat *sVSesstat;
int sRowCount;

/* Select session whose ID is 1 */
sRowCount = ABIGetVSesstatBySID ( &sVSesstat, 1 );

ABIGetStatName#

Syntax#

int ABIGetStatName (
    ABIStatName          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIStatName ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the values of the fixed columns, SEQNUM and NAME, from the V$SESSTAT or V$SYSSTAT performance view.

Example#

Please refer to sample_3.c for an application related to this function.

ABIStatName *sStatName;
int sRowCount;

sRowCount = ABIGetStatName( &sStatName );

ABIGetVSystemEvent#

Syntax#

int ABIGetVSystemEvent (
    ABIVSystemEvent          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIVSystemEvent ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SYSTEM_EVENT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSystemEvent type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_4.c for an application related to this function.

ABIVSystemEvent *sVSystemEvent;
int sRowCount;

sRowCount = ABIGetVSystemEvent( &sVSystemEvent);

ABIGetVSessionEvent#

Syntax#

int ABIGetVSessionEvent (
    ABIVSessionEvent          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIVSessionEvent ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SESSION_EVENT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSessionEvent type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_4.c for an application related to this function.

ABIVSessionEvent *sVSessionEvent;
int sRowCount;

sRowCount = ABIGetVSessionEvent( &sVSessionEvent);

ABIGetVSessionEventBySID#

Syntax#

int ABIGetVSessionEventBySID (
    ABIVSessionEvent         **aHandle,
    int                      aSessionID );

Arguments#

Data Type Argument In/Output Description
ABIVSessionEvent ** aHandle Output The pointer which retrieves the memory address of the structure array that sotres the result set
int aSessionID Input The session ID to be selected

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects statistics about wait events for certain sessions from the V$SESSION_EVENT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSessionEvent type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_4.c for an application related to this function.

ABIVSessionEvent *sVSessionEvent;
int sRowCount;

sRowCount = ABIGetVSessionEventBySID( &sVSessionEvent, 1);

ABIGetEventName#

Syntax#

int ABIGetEventName (
    ABIEventName          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIEventName ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the values of the fixed columns, EVENT_ID, EVENT, WAIT_CLASS_ID, and WAIT_CLASS, from the V\$SYSTEM_EVENT or V​\$SESSION_EVENT performance view.

Example#

Please refer to sample_4.c for an application related to this function.

ABIEventName *sEventName;
int sRowCount;

sRowCount = ABIGetEventName( &sEventName);

ABIGetVSessionWait#

Syntax#

int ABIGetVSessionWait (
    ABIVSessionWait          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIVSessionWait ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the V$SESSION_WAIT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSessionWait type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_8.c for an application related to this function.

ABIVSessionWait *sVSessionWait;
int sRowCount;

sRowCount = ABIGetVSessionWait( &sVSessionWait);

ABIGetVSessionWaitBySID#

Syntax#

int ABIGetVSessionWaitBySID (
    ABIVSessionWait          **aHandle,
    int                      aSessionID );

Arguments#

Data Type Argument In/Output Description
ABIVSessionWait ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
int aSessionID Input The session ID to be selected

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects information about wait events for certain sessions from the V$SESSION_WAIT performance view. If this function executes successfully, the aHandle pointer (a pointer of the ABIVSessionWait type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_8.c for an application related to this function.

ABIVSessionWait *sVSessionWait;
int sRowCount;

sRowCount = ABIGetVSessionWaitBySID( &sVSessionWait, 1);

ABIGetSqlText#

Syntax#

int ABIGetSqlText (
    ABISqlText          **aHandle,
    int                 astmtID );

Arguments#

Data Type Argument In/Ouput Description
ABISqlText ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set
int astmtID Input The session ID to be selected
If aStmtID is 0, all information of the currently active statement is returned.

Return Values#

If the function succeeds, it returns 0. If unsuccessful, an error code is returned as a negative integer value.

Description#

This is a function used for viewing SQL statement, the start time of a query, and checking whether or not to execute a query that a statement is executing through the statement identifier.

Example#

Please refer to sample_5.c for an application related to this function.

ABISqlText *sSqlText;
int sRet;

/* Selects the SQL statement of the statement which ID is 2 */
sRet = ABIGetSqlText( &sSqlText, 2 );

ABIGetLockPairBetweenSessions#

Syntax#

int ABIGetLockPairBetweenSessions (
    ABILockPair          **aHandle );

Argument#

Data Type Argument In/Output Description
ABILockPair ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns the number of rows in the result set that aHandle points to; otherwise, returns an error code.

Description#

This function selects the session that is holding a lock and the session that is waiting to acquire that lock. If this function executes successfully, the aHandle pointer (a pointer of the ABILockPair type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_5.c for an application related to this function.

ABILockPair *sLockPair;
int sRowCount;

sRowCount = ABIGetLockPairBetweenSessions( &sLockPair );

ABIGetDBInfo#

Syntax#

int ABIGetDBInfo (
    ABIDBInfo          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIDBInfo ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns 0; otherwise, returns an error code.

Description#

This function selects the database name and its version number. If this function executes successfully, the aHandle pointer (a pointer of the ABIDBInfo type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_6.c for an application related to this function.

ABIDBInfo *sDBInfo;
int sRet;

sRet = ABIGetDBInfo( &sDBInfo );

ABIGetReadCount#

Syntax#

int ABIGetReadCount (
    ABIReadCount          **aHandle );

Argument#

Data Type Argument In/Output Description
ABIReadCount ** aHandle Output The pointer which retrieves the memory address of the structure array that stores the result set

Return Values#

If successful, returns 0; otherwise, returns an error code.

Description#

This function selects the number of times data pages were read on the Altibase server. If this function executes successfully, the aHandle pointer (a pointer of the ABIReadCount type that points to an array that stores the result set) is returned.

Example#

Please refer to sample_6.c for an application related to this function.

ABIReadCount *sReadCount;
int sRet;

sRet = ABIGetReadCount( &sReadCount);

ABIGetSessionCount#

Syntax#

int ABIGetSessionCount (
    unsigned int          **aExecutingOnly );

Argument#

Data Type Argument In/Output Description
unsigned int aExecutingOnly Input 0: Selects all sessions
1: Selects only active sessions

Return Values#

If successful, returns the total number of sessions in the Altibase server; otherwise, returns an error code.

Description#

This function selects the total number of sessions currently existing in the Altibase server or the number of active sessions.

Example#

Please refer to sample_2.c for an application related to this function.

int sSessionCount;
int sActiveSessionCount;

/* Selects the total number of sessions  */
sSessionCount = ABIGetSessionCount( 0 );
/* Selects the number of active sessions */
sActiveSessionCount  = ABIGetSessionCount( 1 );

ABIGetMaxClientCount#

Syntax#

int ABIGetMaxClientCount ( );

Return Values#

If successful, returns the maximum number of clients allowed to connect to the Altibase server; otherwise, returns an error code.

Description#

This function selects the maximum number of clients allowed to connect to the Altibase server. The selected value corresponds to the value set for the MAX_CLIENT property in the altibase.properties file for the Altibase server.

Example#

Please refer to sample_2.c for an application related to this function.

int sMaxClientCount;

sMaxClientCount = ABIGetMaxClientCount( );

ABIGetLockWaitSessionCount#

Syntax#

int ABIGetLockWaitSessionCount ( );

Return Values#

If successful, returns the number of sessions waiting to acquire locks; otherwise, returns an error code.

Description#

This function selects the number of sessions waiting to acquire locks on the Altibase server.

Example#

Please refer to sample_5.c for an application related to this function.

int sLockWaitSessionCount;

sLockWaitSessionCount = ABIGetLockWaitSessionCount( );

ABIGetRepGap#

Syntax#

int ABIGetRepGap(
   ABIRepGap **aHandle );

Return Values#

If the function succeeds, the function returns the number of rows in the result set brought to aHandle. If it fails, an error code is returned as a negative integer.

Description#

In the V\$REPGAP performance view, this function retrieves the difference between the last log record sent by the replication sender and the most recently created log record.

If the function succeeds, a pointer to an array of type ABIRepGap containing the result set in aHandle is returned.

Example#

Please refer to sample_10.c for an application related to this function.

ABIRepGap *sRepGap;
int sRowCount;

sRowCount = ABIGetRepGap( &sRepGap );

ABIGetRepSentLogCount#

Syntax#

int ABIGetRepSentLogCount(
   ABIRepSentLogCount **aHandle );

Return Values#

If the function succeeds, the number of rows in the result set brought to aHandle is returned. If unsuccessful, an error code is returned as a negative integer value.

Description#

In the V\$REPSENDER_SENT_LOG_COUNT performance view, this function searches the number of rows by classifying logs sent by the redundant sender by DML type.

If the function succeeds, a pointer to an array of type ABIRepSentLogCount is stored, which contains the result set in aHandle.

Example#

Please refer to sample_10.c for an application related to this function.

ABIRepSentLogCount *sRepSentLogCount;
int sRowCount;

sRowCount = ABIRepSentLogCount( &sRepSentLogCount );

ABIGetErrorMessage#

Syntax#

void ABIGetErrorMessage (
    int                 aErrCode,
    const char          *aErrMsg );

Arguments#

Data Type Argument In/Output Description
int aErrCode Input Error code
const char * aErrMsg Output The buffer pointer that retrieves the error message

Description#

This function selects an error message by its error code. When a function of Monitoring API returns an error code, an error message corresponding to the error code can be inquired.

Example#

Please refer to sample_9.c for an application related to this function.

ABIVSession *sVSession;
int          sErrCode;
const char  *sErrMsg;

sErrCode = ABIGetVSession( &sVSession, 1 );
if( sErrCode < 0 )
{
    ABIGetErrorMessage( sErrCode, &sErrMsg );
}