Sambar Server Documentation

sa_conn_key


Purpose

Gets, sets, or clears data associated with a user connection. The Sambar Server allows an application to store data at the connection handle, thereby making this data available across subsequent method executions.

Syntax

sa_conn_key (connection, action, key, value);

SA_CONN *connection;
SA_INT action;
SA_CHAR *key;
SA_VOID **value;

Parameters

connection Server connection.
action To get the data associated with key, specify SA_GET.

To associate data with key, specify SA_SET.

To clear the data associated with key, specify SA_CLEAR.

key The key (name) associated with the data being retrieved, set, or cleared. The function's key parameter enables an application to separately store and retrieve multple pieces of data by uniquely naming each one. The length of the key can not exceed 50 bytes.
value If action is SA_GET, the value of key is returned in this parameter.

If action is SA_SET, specify the value to assign to key.

If action is SA_CLEAR, specify NULL.

Returns

SA_SUCCEED if the function is successful; SA_FAIL otherwise.

Comments

A key is simply a name assigned to a particular piece of data, making it easy to reference the data. Unlike data stored with sa_ctx_key, data stored with sa_conn_key is placed in a private data area inaccessible to other applications.

Applications can associate data of any kind with a key.

Applications are responsible for allocating memory in which to store the data before calling sa_conn_key(SA_SET). This also means that when clearing data, applications are responsible for de-allocating that same memory.

See Also

sa_ctx_key

© 1998 Sambar Technologies. All rights reserved. Terms of Use.