srv_envchange

Description

Notify the client of an environment change.

Syntax

CS_RETCODE srv_envchange(spp, type, oldvalp
            oldvallen, newvalp, newvallen)
SRV_PROC    *spp;
CS_INT          type;
CS_CHAR     *oldvalp;
CS_INT         oldvallen
CS_CHAR     *newvalp;
CS_INT         newvallen

Parameters

spp

A pointer to an internal thread control structure.

type

The environment being changed. Currently, the only legal values are SRV_ENVDATABASE and SRV_ENVLANG, the name of the current database and the current national language, respectively.

oldvalp

A pointer to the character string containing the old value. It can be NULL. Its length in bytes is stored in oldvallen.

oldvallen

The length, in bytes, of the string in *oldvalp. It can be CS_NULLTERM, which indicates that the string in *oldvalp is null terminated. It can also be CS_UNUSED, indicating that the string in *oldvalp is NULL.

newvalp

A pointer to the character string containing the new value of the environment variable. It can be null. Its length in bytes is stored in newvallen.

newvallen

The length, in bytes, of the string in *newvalp. It can be CS_NULLTERM, which indicates that the string in newvalp is null terminated. It can also be CS_UNUSED, indicating that the string in *newvalp is NULL.

Returns

Table 3-42: Return values (srv_envchange)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include   <ospublic.h>
/*
 ** Local Prototype.
 */
CS_RETCODE  ex_srv_envchange PROTOTYPE((
SRV_PROC    *spp
));
/*
 ** EX_SRV_ENVCHANGE
**
**    Example routine to notify the client of an environment
 **    change.
**
** Arguments:
**    spp    A pointer to an internal thread control structure.
**
** Returns:
**     CS_SUCCEED    Succesfully notified client of environment
 **                   change.
**     CS_FAIL       An error was detected.
**
*/
CS_RETCODE   ex_srv_envchange(spp)
SRV_PROC     *spp;
{
    CS_RETCODE   retval;
    /*
     ** Notify the client that we’ve changed the database
     ** from “master” to “pubs2”.
     */
    retval = srv_envchange(spp, SRV_ENVDATABASE, “master”,
             CS_NULLTERM, “pubs2”, CS_NULLTERM);
    return (retval);
}

Usage