smc_create_recording_session

Description

Initiates the definition of a recording session on Historical Server.

This function is applicable only if the connection mode is SMC_SERVER_M_HISTORICAL.

Syntax

SMC_RETURN_CODE smc_create_recording_session 
 (SMC_CONNECT_ID           clientId,
 	SMC_CHARP                SMSName,
 	SMC_INT                  sampleInterval,
 	SMC_CHARP                directoryName,
 	SMC_CHARP                startTime,
 	SMC_CHARP                endTime,
 	SMC_HS_SESS_PROT_LEVEL   protectionLevel,
 	SMC_HS_SESS_ERR_OPT      errOption,		SMC_HS_SESS_SCRIPT_OPT   scriptOption,					SMC_SESSION_IDP          sessionIdHandle)

Parameters

clientId

identifies the connection.

SMSName

null-terminated string containing the name of the Monitor Server.

sampleInterval

the number of seconds to wait between consecutive samplings of data.

directoryName

null-terminated string containing the full path name to the directory containing the data and error files created by Historical Server during execution of this recording session.

The directory must be writable on the system on which Historical Server is running. This might not be the same system that is running the client application that invoked the function call.

startTime

null-terminated string containing the time to start recording, using the format:

yyyy/mm/dd hh:mm[:ss] [time zone]

The default is to start immediately.

endTime

null-terminated string containing the time at which to stop the recording, using the format:

yy/mm/dd hh:mm[:ss] [time zone]

The default is to stop 24 hours after startTime.

protectionLevel

protection level of the data recorded. Valid values are:

errOption

indicate what Historical Server must do when encountering a non-fatal error. The choices are:

scriptOption

indicate whether Historical Server must create a script that creates tables for loading results (from this recording session) into Adaptive Server. The choices are:

sessionIdHandle

pointer to a variable, which should be declared as type SMC_SESSION_ID. If the call to smc_create_recording_session succeeds, this variable contains the ID for the recording session.

Returns

Return value

Indicates

SMC_RET_SUCCESS

Function succeeded.

SMC_RET_FAILURE

Function failed.

SMC_RET_INVALID_CONNECT

Connection does not exist.

Examples

Example 1

This example assumes that you have created a connection to Historical Server and have a clientId.

SMC_SESSION_ID  sessionId;
 SMC_SESSION_IDP sessionIdHandle = &sessionId;
if (smc_create_recording_session(clientId,
         "myMonitorServer",
         60,   /* sample interval (seconds) */
         "/usr/hist_serv_home_dir",
         "95/07/22 15:00",  /* start time */
         "95/07/23 15:30",  /* end time */
         SMC_HS_SESS_PROT_PUBLIC,
         SMC_HS_SESS_ERR_CONT,
         SMC_HS_SESS_SCRIPT_SYBASE,
         sessionIdHandle) != SMC_RET_SUCCESS) 
 {
 printf("smc_create_recording_session failed\n");
 		/* do some cleanup */
 }

Usage


Valid server modes

Mode

Availability

SMC_SERVER_M_LIVE

No

SMC_SERVER_M_HISTORICAL

Yes


Errors

Error

Indicates

SMC_RET_INTERNAL_ERROR

Internal error

SMC_RET_INVALID_SVR_MODE

Invalid server mode

See also

smc_initiate_recording