smc_create_playback_session

Description

Initializes a playback session on Historical Server.

Syntax

SMC_RETURN_CODE smc_create_playback_session 
 (SMC_CONNECT_ID           clientId,
 	SMC_SESSION_IDP          sessionIdArray,
 	SMC_SIZET                numInputSessions,
 	SMC_CHARP                startTime,
 	SMC_CHARP                endTime,
 	SMC_HS_PLAYBACK_OPT      playbackType,
 	SMC_SIZET                summarizationInterval,
 	SMC_HS_ESTIM_OPT         estimationOption,
 	SMC_HS_MISSDATA_OPT      missingDataOption,
  SMC_HS_TARGET_OPT        playbackTarget,
  SMC_CHARP		                directoryName
	SMC_HS_SESS_PROT_LEVEL   protectionLevel,		SMC_HS_SESS_SCRIPT_OPT   scriptOption,
 	SMC_HS_SESS_DELETE_OPT   deleteOption,
 	SMC_SESSION_IDP 						 sessionIdHandle)

Parameters

clientId

identifies the connection.

sessionIdArray

array of session numbers identifying the existing recording session(s) on Historical Server that furnishes data for this playback session. If more than one input session is specified, then they all must have been defined to record data from the same Adaptive Server, and they must be ordered chronologically.

If playbackTarget is SMC_HS_TARGET_FILE, then there must not be any gaps between the times covered by multiple input sessions. The input sessions must contain data for all times between the startTime and endTime parameters.

numInputSessions

the number of input sessions, that is, the length of the sessionIdArray. Must be at least one.

startTime

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

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

The default is to start at the beginning of the first input session.

endTime

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

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

The default is to stop at the end of the last input session.

playbackType

specifies the level of detail of the playback. Valid values are:

If playbackTarget is SMC_HS_TARGET_FILE, then playbackType must be SMC_HS_PBTYPE_INTERVAL or SMC_HS_PBTYPE_ENTIRE.

summarizationInterval

if playbackType is SMC_HS_PBTYPE_INTERVAL, then this specifies the length in seconds of the playback intervals over which the input data is to be summarized.

For other values of playbackType, applications must specify SMC_UNUSED for this parameter.

estimationOption

specifies whether playback may estimate the values of data items that cannot be calculated exactly. Valid values are:

If SMC_HS_ESTIM_DISALLOW is specified, then a subsequent call for this playback session to smc_create_view will return an error if it includes data items requiring estimation.This option is ignored if playbackType is SMC_HS_PBTYPE_RAW.

missingDataOption

specifies whether the Monitor Client Library will return playback samples for periods of time when no data is available in the input session(s). Valid values are:

If playbackTarget is SMC_HS_TARGET_FILE, this parameter is ignored.

playbackTarget

specifies whether the playback session returns data to the application or whether playback creates a new session on Historical Server. Valid values are:

directoryName

if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies the directory in which the Historical Server creates the data file(s) and error file for the new sessions to be created.

protectionLevel

if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies the protection level of the new session to be created. Valid values are:

This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.

scriptOption

if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies whether Historical Server must create a script that creates tables for loading results (from the new session) into Adaptive Server. The choices are:

This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.

deleteOption

if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies whether Historical Server must delete the input session(s) after successfully creating a new session. The choices are:

This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.

sessionIdHandle

if playbackTarget is SMC_HS_TARGET_FILE, this parameter must be a pointer to a variable of type SMC_SESSION_ID, into which the Monitor Client Library writes the identifier for the new session.

This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.

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  inputSessions[2];

if (smc_create_playback_session(clientId,
         inputSessions,
         2,/* number of input sessions */
"",/* default start time */
"",/* default end time */
         SMC_HS_PBTYPE_INTERVAL,/* summarize at */
         60,/* uniform minute intervals */
         SMC_HS_ESTIM_ALLOW,/* allow estimation */
         SMC_HS_MISSDATA_SHOW, /* produce a sample*/
              /* every minute even if no data is */
              /* available for that interval */
         SMC_HS_TARGET_CLIENT, /* do playback */
         "",/* directory name */
         SMC_HS_SESS_PROT_PUBLIC,/* so next 5 */
         SMC_HS_SESS_SCRIPT_SYBASE,/* are */
         SMC_HS_DELETE_FILES,/* unused */
         NULL)/* No output session ID */
    != SMC_RET_SUCCESS) 
 {
	printf("smc_create_playback_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_INVALID_SVR_MODE

Invalid server mode

See also

smc_initiate_playback