EssListRequests

Returns information about active sessions and requests.

Syntax

ESS_FUNC_M EssListRequests (hCtx, UserName, AppName, DbName, RequestCount, pRequestInfo);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

UserName

ESS_STR_T

User name

AppName

ESS_STR_T

Application name

DbName

ESS_STR_T

Database name

RequestCount

ESS_PUSHORT_T

Number of requests (output)

ppRequestInfoStruct

ESS_PPREQUESTINFO_T

Request type (output)

Notes

Return Value

Returns zero if successful; error code if unsuccessful.

Example

#include <stdio.h>
#include <essapi.h>

ESS_FUNC_M ESS_ListRequest ()
{
    ESS_FUNC_M       sts     = ESS_STS_NOERR;
    ESS_STR_T     rString = NULL;
    ESS_HCTX_T   hCtx;
    ESS_USHORT_T Items;
    ESS_PAPPDB_T pAppsDbs = NULL; 
    ESS_HINST_T  hInst ;
    ESS_ACCESS_T Access;
    ESS_USHORT_T numRequest; 
    ESS_PREQUESTINFO_T requestInfo; 

    ESS_INIT_T InitStruct =        /* Define init */
                    /* structure */ 
    { 
        ESS_API_VERSION,       /* Version of API */
        NULL,      /* user-defined message context */
        0,         /* max handles     */
        0L,        /* max buffer size */
        NULL, /* local path */
        /* The following parameters use defaults  */
        NULL,      /* message db path */
        NULL,      /* allocation function pointer */
        NULL,      /* reallocation function pointer */
        NULL,      /* free function pointer */
        NULL,   /* error handling function pointer */
        NULL,      /* path name of user-defined */
               /* Application help file */
        NULL,      /* Reserved for internal use. */
               /* Set to NULL */
    };
   
    EssInit (&InitStruct, &hInst); 

    sts = EssLogin (hInst, "local", "admin", "password", &Items, &pAppsDbs, &hCtx);

    sts = EssListRequests( hCtx, NULL, NULL, NULL, &numRequest, &requestInfo); 

    printf ( "Total requests on the server %d\n", numRequest ); 
    
    if ( !sts && requestInfo )
    {
        ESS_USHORT_T index = 0; 
        
        while ( index < numRequest )
        {
            printf ( "login ID = %ul\n", requestInfo[index].LoginId ); 
            printf ( "user name = %s\n", requestInfo[index].UserName );
            printf ( "login machine = %s\n", requestInfo[index].LoginSourceMachine ); 
            printf ( "AppName = %s\n", requestInfo[index].AppName ); 
            printf ( "DbName = %s\n", requestInfo[index].DbName ); 
            printf ( "DbRequestCode = %u\n", requestInfo[index].DbRequestCode ); 
            printf ( "RequestString = %s\n", requestInfo[index].RequestString ); 
            printf ( "TimeStarted = %ul\n", requestInfo[index].TimeStarted ); 
            printf ( "State = %d\n", requestInfo[index].State ); 
            printf ( "\n\n--------------------------------------\n\n", requestInfo[index].State ); 

            sts = EssKillRequest (hCtx, &requestInfo[index] );

            index++; 
        }

        EssFree ( hInst, requestInfo );
    }

    EssLogout (hCtx);
    EssTerm (hInst);
    return(sts);
}

void main() 
{
    ESS_ListRequest (); 
}

See Also