Returns information about active sessions and requests.
Syntax
ESS_FUNC_M EssListRequests (hCtx, UserName, AppName, DbName, RequestCount, pRequestInfo);
Parameter | Data Type | Description |
---|---|---|
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
A session is the time in seconds between a 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.
Some of the listed requests may have been recently terminated, but are still listed as active due to network delay.
This function returns information on requests/sessions initiated by the process specified by the UserName, AppName, and DbName. If these parameters are null or empty, then all the processes in the system are listed. This function returns the number of current requests and one ESS_REQUESTINFO_T structure for each request.
The returned ppRequestInfoStruct needs to be freed by calling EssFree.
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