EssKillRequest

Terminates specific Essbase user sessions or requests.

Syntax

ESS_FUNC_M EssKillRequest (hCtx, pRequestInfoStruct);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

pRequestInfoStruct

ESS_PREQUESTINFO_T

Pointer to the Request Information structure.

Notes

EssKillRequest() uses the information in ESS_REQUESTINFO_T regarding current sessions and requests terminate a specific user session. This function can also be used to terminate (without logging out the user) any active requests being made to an application, a database, or the system during a user session.

A session is the time in seconds between an Essbase user's login and logout.

A request is a query sent to Essbase by a user or by another process; for example, starting an application, or restructuring a database outline. Each session can process only one request at a time; therefore, sessions and requests have a one-to-one relationship.

This function terminates the sessions/requests specified by the UserName, AppName, and DbName specified in the ESS_REQUESTINFO_T structure. If those fields are null, this function terminates all sessions/requests initiated by this process (user). The application program is responsible for allocating and freeing the memory used by ESS_REQUESTINFO_T.

Return Value

Returns zero if successful; error code if unsuccessful.

Example

#include 
#include 

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 = EssSetActive ( hCtx, "sample", "basic", &Access );

    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