cs_config

Description

Set or retrieve CS-Library properties.

Syntax

CS_RETCODE cs_config(context, action, property,
                     buffer, buflen, outlen)
 
 CS_CONTEXT          *context;
 CS_INT                     action;
 CS_INT                     property;
 CS_VOID                  *buffer;
 CS_INT                     buflen;
 CS_INT                     *outlen;

Parameters

context

A pointer to a CS_CONTEXT structure.

action

One of the following symbolic values:

action

cs_config

CS_SET

Sets the value of the property.

CS_GET

Retrieves the value of the property.

CS_CLEAR

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

property

The property whose value is being set or retrieved, according to the following table:

Table 2-1: Values for cs_config property parameter

Value of property

Controls

Action

*buffer is

CS_APPNAME

The name the application calls itself.

Set, retrieve, or clear.

A CS_CHAR string.

The default is NULL.

CS_CONFIG_FILE

The name and path of the Open Client and Open Server runtime configuration file. Meaningful only when external configuration has been enabled by setting CS_EXTERNAL_CONFIG.

Set, retrieve, or clear.

A CS_CHAR string.

The default is NULL, which means a platform-specific default is used. See “Runtime configuration file property” for more information.

CS_DEFAULT_ IFILE

The name and path to an alternate default interfaces file.

Set, retrieve, or clear.

A CS_CHAR string to the new interfaces file.

CS_EXTERNAL_ CONFIG

Whether or not the Client-Library routine ct_init reads an external configuration file to set default property values.

Set, retrieve, or clear.

CS_TRUE or CS_FALSE.

The default, CS_TRUE, is dependent on whether the external configuration file exists. See “External configuration property” for more information.

CS_EXTRA_INF

Whether or not to return the extra information that is required when processing messages inline using a SQLCA, SQLCODE, or SQLSTATE structure.

Set, retrieve, or clear.

CS_TRUE or CS_FALSE.

CS_FALSE is the default.

CS_LIBTCL_CFG

The name and path to an alternate libtcl.cfg file.

Set, retrieve, or clear.

A CS_CHAR string to the new libtcl.cfg configuration file.

CS_LOC_PROP

A CS_LOCALE structure that defines localization information for this context.

Set, retrieve, or clear.

A CS_LOCALE structure previously allocated by the application.

CS_MESSAGE_CB

The CS-Library message callback routine, which is an application-provided handler for CS-Library error and informational messages.

Set, retrieve, or clear.

If action is CS_SET, *buffer is the message callback routine.

If action is CS_GET, *buffer is set to the address of the message callback routine that is currently installed.

The default is NULL, which means no handler is installed.

CS_NOAPI_CHK

Whether or not CS-Library validates function arguments when library functions are called.

Set, retrieve, or clear.

CS_TRUE or CS_FALSE.

CS_FALSE, the default, indicates that argument checking is performed.

CS_SYBASE_ HOME

The location of an alternate Sybase home directory.

Set, retrieve, or clear.

A CS_CHAR string to the new Sybase home directory.

CS_USERDATA

User-allocated data.

Set, retrieve, or clear.

User-allocated data.

A default is not applicable.

CS_VERSION

The version of CS-Library.

Retrieve only.

A symbolic code indicating the library version:

  • CS_VERSION_100 indicates the context exhibits version 10.0 behavior.

  • CS_VERSION_110 indicates version 11.1 behavior.

  • CS_VERSION_120 indicates the context exhibits version 12.0 behavior.

  • CS_VERSION_125 indicates version 12.5 behavior.

  • CS_VERSION_150 indicates version 15.0 behavior.

buffer

If a property value is being set, buffer points to the value to use in setting the property.

If a property value is being retrieved, buffer points to the space in which cs_config will place the value of the property.

If a property value is being cleared, pass buffer as NULL and buflen as CS_UNUSED.

buflen

Generally, buflen is the length, in bytes, of *buffer.

If a property value is being set and the value in *buffer is null-terminated, pass buflen as CS_NULLTERM.

If *buffer is a fixed-length or symbolic value, pass buflen as CS_UNUSED.

outlen

A pointer to an integer variable.

outlen is not used if a property value is being set.

If a property value is being retrieved, cs_config sets *outlen to the length, in bytes, of the requested information.

If the information is larger than buflen bytes, an application can use the value of *outlen to determine how many bytes are needed to hold the information.

outlen can be passed as NULL if the application is setting a property value or does not require the output length of a retrieved value.

Returns

cs_config returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Usage


Application name property


Runtime configuration file property


External configuration property


Extra Information property


Locale information property


CS-Library Message Callback property


Argument checking for CS-Library calls


User-allocated data property


Sybase home property


libtcl.cfg file property


Default interfaces file property


Version level property

See also

cs_ctx_alloc, ct_con_props, ct_config, ct_init