EssListRequestsEx

Returns information about active sessions and requests. Similar to EssListRequests, but includes users hosted in a user directory.

Syntax

ESS_FUNC_M EssListRequestsEx (hCtx, UserId, bIsIdentity, AppName, DbName, RequestCount, pRequestInfo);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle (input).

UserId

ESS_STR_T

User name or identity (input). If an identity, includes a unique identity string identifying the user in a user directory.

bIsIdentity

ESS_BOOL_T

Indicates if a user identity or name is used (input). If TRUE, indicates that UserId is a unique identity attribute. If FALSE, UserId is a user name.

AppName

ESS_STR_T

Application name (input).

DbName

ESS_STR_T

Database name (input).

RequestCount

ESS_PUSHORT_T

Number of requests (output).

pRequestInfo

ESS_PREQUESTINFOEX_T

Request type (output).

Notes

Return Value

Returns zero if successful; error code if unsuccessful.

Access

This function requires the caller to have database designer privilege (ESS_PRIV_DBDESIGN) for the specified database.

Example

void ListRequestsEx ()
{
	ESS_STS_T sts = ESS_STS_NOERR;
	ESS_STR_T userId;
	ESS_BOOL_T bIsIdentity;
	ESS_USHORT_T numRequest; 
	ESS_PREQUESTINFOEX_T requestInfo;
	ESS_USHORT_T index = 0; 
   
	userId = "admin";
	bIsIdentity = ESS_FALSE;
	sts = EssListRequestsEx(hCtx, userId, bIsIdentity, "Sample", "Sample1", &numRequest, &requestInfo); 
	printf("\nEssListRequestsEx sts: %ld\n", sts);
	printf ( "Total requests on the server: %d\n", numRequest ); 
	if ( !sts && requestInfo )
	{
		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 = EssKillRequestEx (hCtx, &requestInfo[index] );

			index++; 
		}

		EssFree ( hInst, requestInfo );
	}

	userId = " native://nvid=f0ed2a6d7fb07688:5a342200:1265973105c:-7f46?USER ";
	bIsIdentity = ESS_TRUE;
	sts = EssListRequestsEx(hCtx, userId, bIsIdentity, "Sample", "Sample1", &numRequest, &requestInfo); 
	printf("\nEssListRequestsEx sts: %ld\n", sts);
	printf ( "Total requests on the server: %d\n", numRequest ); 
	if ( !sts && requestInfo )
	{
		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 = EssKillRequestEx (hCtx, &requestInfo[index] );

			index++; 
		}

		EssFree ( hInst, requestInfo );
	}
}

See Also

  • EssKillRequestEx