Convert an Open Server token value to a readable string.
CS_CHAR *srv_symbol(type, symbol, lenp)
CS_INT type; CS_INT symbol; CS_INT *lenp;
The type of token. Table 3-137 describes the legal token types:
Token Type |
Description |
---|---|
SRV_DATATYPE |
A datatype |
SRV_EVENT |
An event type |
SRV_DONE |
A DONE status type |
SRV_ERROR |
An error severity token |
The actual token value.
A pointer to a CS_INT variable that will contain the length of the returned string.
Returns |
To indicate |
---|---|
A pointer to a null terminated character string that is a readable translation of an Open Server token value. |
The token value. |
A null pointer |
Open Server does not recognize the type or symbol. Open Server sets lenp to -1. |
#include <ospublic.h>
/*
** Local Prototype
*/
extern CS_RETCODE ex_srv_symbol PROTOTYPE((
CS_INT type,
CS_INT symbol,
CS_CHAR *namep
));
/*
** EX_SRV_SYMBOL
**
** Retrieve a printable string representation of an Open Server
** symbol
**
** Arguments:
** type Symbol type
** symbol Symbol for which to retrieve string
** namep Return symbol string here
** Returns:
** CS_SUCCEED Symbol string was retrieved successfully
** CS_FAIL An error was detected
*/
CS_RETCODE ex_srv_symbol(type, symbol, namep)
CS_INT type;
CS_INT symbol;
CS_CHAR *namep;
{
CS_INT len;
namep = srv_symbol(type, symbol, &len);
if(namep == (CS_CHAR *)NULL)
{
return(CS_FAIL);
}
return(CS_SUCCEED);
}
srv_symbol returns a pointer to a readable null terminated string that describes an Open Server token value.
The pointer srv_symbol returns points to space that is never overwritten, so it is safe to call srv_symbol more than once in the same statement.
Table 3-139 summarizes the tokens srv_symbol can convert:
Token type |
Token |
Description |
---|---|---|
SRV_ERROR |
SRV_INFO |
Error severity type |
SRV_ERROR |
SRV_FATAL_PROCESS |
Error severity type |
SRV_ERROR |
SRV_FATAL_SERVER |
Error severity type |
SRV_DONE |
SRV_DONE_MORE |
DONE packet status field |
SRV_DONE |
SRV_DONE_ERROR |
DONE packet status field |
SRV_DONE |
SRV_DONE_FINAL |
DONE packet status field |
SRV_DONE |
SRV_DONE_FLUSH |
DONE packet status field |
SRV_DONE |
SRV_DONE_COUNT |
DONE packet status field |
SRV_DATATYPE |
CS_CHAR_TYPE |
Char datatype |
SRV_DATATYPE |
CS_BINARY_TYPE |
Binary datatype |
SRV_DATATYPE |
CS_TINYINT_TYPE |
1-byte integer datatype |
SRV_DATATYPE |
CS_SMALLINT_TYPE |
2-byte integer datatype |
SRV_DATATYPE |
CS_INT_TYPE |
4-byte integer datatype |
SRV_DATATYPE |
CS_REAL_TYPE |
Real datatype |
SRV_DATATYPE |
CS_FLOAT_TYPE |
Float datatype |
SRV_DATATYPE |
CS_BIT_TYPE |
Bit datatype |
SRV_DATATYPE |
CS_DATETIME_TYPE |
Datetime datatype |
SRV_DATATYPE |
CS_DATETIME4_TYPE |
4-byte datetime datatype |
SRV_DATATYPE |
CS_MONEY_TYPE |
Money datatype |
SRV_DATATYPE |
CS_MONEY4_TYPE |
4-byte money datatype |
SRV_DATATYPE |
SRVCHAR |
Char datatype |
SRV_DATATYPE |
SRVVARCHAR |
Variable-length char datatype |
SRV_DATATYPE |
SRVBINARY |
Binary datatype |
SRV_DATATYPE |
SRVVARBINARY |
Variable-length binary datatype |
SRV_DATATYPE |
SRVINT1 |
1-byte integer datatype |
SRV_DATATYPE |
SRVINT2 |
2-byte integer datatype |
SRV_DATATYPE |
SRVINT4 |
4-byte integer datatype |
SRV_DATATYPE |
SRVINTN |
Integer datatype, nulls allowed |
SRV_DATATYPE |
SRVBIT |
Bit datatype |
SRV_DATATYPE |
SRVDATETIME |
Datetime datatype |
SRV_DATATYPE |
SRVDATETIME4 |
4-byte datetime datatype |
SRV_DATATYPE |
SRVDATETIMN |
Datetime datatype, nulls allowed |
SRV_DATATYPE |
SRVMONEY |
Money datatype |
SRV_DATATYPE |
SRVMONEY4 |
4-byte money datatype |
SRV_DATATYPE |
SRVMONEYN |
Money datatype, nulls allowed |
SRV_DATATYPE |
SRVREAL |
4-byte float datatype |
SRV_DATATYPE |
SRVFLT8 |
8-byte float datatype |
SRV_DATATYPE |
SRVFLTN |
8-byte float datatype, nulls allowed |
SRV_DATATYPE |
SRV_LONGCHAR_TYPE |
Long char datatype |
SRV_DATATYPE |
SRV_LONGBINARY_TYPE |
Long binary datatype |
SRV_DATATYPE |
SRV_TEXT_TYPE |
Text datatype |
SRV_DATATYPE |
SRV_IMAGE_TYPE |
Image datatype |
SRV_DATATYPE |
SRV_NUMERIC_TYPE |
Numeric datatype |
SRV_DATATYPE |
SRV_DECIMAL_TYPE |
Decimal datatype |
SRV_DATATYPE |
SRVVOID |
Void datatype |
SRV_EVENT |
SRV_ATTENTION |
Open Server event type |
SRV_EVENT |
SRV_BULK |
Open Server event type |
SRV_EVENT |
SRV_CONNECT |
Open Server event type |
SRV_EVENT |
SRV_CURSOR |
Open Server event type |
SRV_EVENT |
SRV_DISCONNECT |
Open Server event type |
SRV_EVENT |
SRV_DYNAMIC |
Open Server event type |
SRV_EVENT |
SRV_LANGUAGE |
Open Server event type |
SRV_EVENT |
SRV_MSG |
Open Server event type |
SRV_EVENT |
SRV_OPTION |
Open Server event type |
SRV_EVENT |
SRV_RPC |
Open Server event type |
SRV_EVENT |
SRV_START |
Open Server event type |
SRV_EVENT |
SRV_STOP |
Open Server event type |
SRV_EVENT |
SRV_URGDISCONNECT |
Open Server event type |