smc_connect_props

Description

Sets, retrieves, or clears properties on a connection.

Syntax

SMC_RETURN_CODE smc_connect_props
 (SMC_CONNECT_ID       clientId,
 	SMC_PROP_ACTION      propertyAction,
 	SMC_PROP_TYPE        property,
 	SMC_VALUE_UNIONP     propertyValue,
 	SMC_SIZET            bufferLength,
 	SMC_SIZETP           outputLengthHandle)

Parameters

clientId

identifies the connection.

propertyAction

Property action type. Valid types are:

property

the symbolic name of the property whose value is being set, retrieved, or cleared. See Table 3-5 for a list of this argument’s legal values.

propertyValue

if propertyAction is:

bufferLength

the length of data in bytes of *(propertyValue->stringValue). Used only if propertyValue is a pointer to a string. If propertyAction is:

outputLengthHandle

a pointer to an integer variable. Used only if propertyValue is a pointer to a string. If propertyAction is:

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 previously allocated a connection using smc_connect_alloc and have a clientId.

SMC_VALUE_UNION  value.sizetValue = 512;
 if (smc_connect_props(clientId,
     SMC_PROP_ACT_SET,
     SMC_PROP_PACKETSIZE,
     &value,
     0,
     NULL) != SMC_RET_SUCCESS) 
 {
 		printf("smc_connect_props failed\n");
 		/* do some cleanup */
 }

Usage

Table 3-5: Monitor Client Library connection properties

Property

Set/ Get/ Clear

*propertyValue is

Default

SMC_PROP_APPNAME

All

SMC_CHARP

An empty string

SMC_PROP_ERROR_ CALLBACK

Set/ Get

A function pointer (use voidpValue member of SMC_VALUE_UNION)

SMC_PROP_IFILE

All

SMC_CHARP

Empty string, signifying the interfaces file in directory where the SYBASE environment variable points (on Windows, sql.ini in the ini subdirectory)

SMC_PROP_LOGIN_TIMEOUT

All

SMC_SIZET

0 (Use the server default)

SMC_PROP_PACKETSIZE

All

SMC_SIZET

0 (Use the server default)

SMC_PROP_PASSWORD

Set/ Clear

SMC_CHARP

An empty string

SMC_PROP_SERVERMODE

All

SMC_INT

SMC_SERVER_M_LIVE

SMC_PROP_SERVERNAME

All

SMC_CHARP

An empty string

SMC_PROP_TIMEOUT

All

SMC_SIZET

0 (Use the server default)

SMC_PROP_USERDATA

All

SMC_VOIDP

NULL

SMC_PROP_USERNAME

All

SMC_CHARP

An empty string


Properties

Property

Description

SMC_PROP_APPNAME

The name of the application using Monitor Client Library. This property can be modified at any time, but takes effect only when smc_connect_ex is called.

SMC_PROP_ERROR_ CALLBACK

The error callback function. This property can be modified at any time during the connection.

SMC_PROP_IFILE

The interfaces file. This property can be modified at any time, but takes effect only when smc_connect_ex is called.

SMC_PROP_LOGIN_TIMEOUT

The timeout value (in seconds) used during login time. This property can be modified at any time, but takes effect when only smc_connect_ex is called.

SMC_PROP_PACKETSIZE

The packet size to use for communicating to the servers. This property can be modified at any time during the connection.

SMC_PROP_PASSWORD

The password. This property can be modified at any time, but takes effect only when smc_connect_ex is called.

SMC_PROP_SERVERMODE

The server mode. This property can be set only before a connection is established. It can be modified at any time, but takes effect when only smc_connect_ex is called. The value is an enum: SMC_SERVER_MODE. See “Enum: SMC_SERVER_MODE”.

SMC_PROP_SERVERNAME

The server name. This property can be modified at any time, but takes effect only when smc_connect_ex is called.

SMC_PROP_TIMEOUT

The timeout value to use for requests sent to the servers. This property can be modified at any time during the connection.

SMC_PROP_USERDATA

A user-supplied pointer. This pointer is passed back to callback functions. It can be changed at any time on an available connection.

SMC_PROP_USERNAME

The username to use for this connection. This property can be modified at any time, but takes effect only when smc_connect_ex is called.


Valid server modes

Mode

Availability

SMC_SERVER_M_LIVE

Yes

SMC_SERVER_M_HISTORICAL

Yes


Errors

Error

Indicates

SMC_RET_INVALID_API_FUNCTION

Invalid use of obsolete and replacement functions in program.

SMC_RET_INVALID_PARAMETER

Invalid parameter value.

See also

smc_connect_alloc, smc_connect_ex