cs_config

Description

Sets or retrieves context structure properties.

Syntax

CS_RETCODE cs_config (context, action,property,
                       buffer, buf_len, outlen);
CS_CONTEXT    *context;
CS_INT        action;
CS_INT        property; 
CS_BYTE       *buffer;
CS_INT        buf_len;
CS_INT        *outlen;

Parameters

context

(I) A context structure for which the properties are being set or retrieved. The context structure is defined in the program call cs_ctx_alloc.

action

(I) Action this call takes. action is an integer variable that indicates the purpose of this call. Assign action one of the following symbolic values:

Value

Meaning

CS_GET (33)

Retrieves the value of the property.

CS_SET (34)

Sets the value of the property.

CS_CLEAR (35)

Clears the value of the property by resetting the property to its default value.

property

(I) Symbolic name of the property for which the value is being set or retrieved. Client-Library properties are listed under “Remote procedure calls (RPCs)”, with descriptions, possible values, and defaults.

Table 3-16 lists the properties that can be set or retrieved by cs_config.

Table 3-16: Values for property (cs_config)

Application action

Property

Indicates

Set, retrieve, or clear

CS_EXTRA_INF

Whether to return the extra information required when processing messages in line, using the SQLCA or SQLCODE structures.

Retrieve only

CS_VERSION

The version number of Open Client currently in use.

buffer

(I/O) Variable (buffer) that contains the specified property value.

If action is CS_SET, cs_config takes the value from this buffer.

If action is CS_GET, cs_config returns the requested information to this buffer.

If action is CS_CLEAR, this value is zeroes.

This argument is typically one of the following datatypes:

	 CS_INT buffer;
 	 CS_CHAR buffer[n];
buf_len

(I) Length, in bytes, of the buffer.

If action is CS_SET and the value in the buffer is a fixed-length or symbolic value, buf_len should have a value of CS_UNUSED.

If action is CS_GET and buffer is too small to hold the requested information, cs_config sets outlen to the length of the requested information and returns CS_FAIL. To retrieve all the requested information, change the value of buf_len to the length returned in outlen and rerun the application.

If action is CS_CLEAR, this value is zeroes.

outlen

(O) Length, in bytes, of the retrieved information. outlen is an integer variable where cs_config returns the length of the property value being retrieved.

When the retrieved information is larger than buf_len bytes, an application uses the value of outlen to determine how many bytes are needed to hold the information.

outlen is used only when action is CS_GET. When action is CS_SET or CS_CLEAR, this value is zeroes.

Returns

cs_config returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

TDS_INVALID_PARAMETER (-4)

One of the cs_config arguments contains an illegal value.

Usage

Notecs_config and ct_config both set and retrieve context properties. cs_config is used with global context properties; ct_config is used with Client-Library properties.


Global Context Properties

See also

Related functions