Returns the user-defined format for a result column.
This function is used with requests to Adaptive Server
Enterprise only.
CS_RETCODE cs_get_format (command, column_num, buffer, buf_len, outlen); CS_COMMAND *command; CS_INT column_num; CS_BYTE *buffer; CS_INT buf_len; CS_INT *outlen;
(I) Handle for this client/server operation. This handle is defined in the associated ct_cmd_alloc call.
(I) Number of the column for which the user-specified format is desired.
column_num refers to the select-list ID of the column. The first column in the select list of a select statement is column number 1, the second is column number 2, and so forth.
(O) Variable (“buffer”) in which ct_get_format places the requested information.
This argument is typically:
char buffer[n];
(I) Length, in bytes, of the buffer.
If buf_len is too small to hold the requested information, ct_get_format sets outlen to the length of the requested information, and returns CS_FAIL.
(O) Length, in bytes, of the format string. outlen is an integer variable where ct_get_format returns the total number of bytes being retrieved.
When the format string is larger than buf_len bytes, an application uses this value to determine how many bytes are needed to hold the string.
If no format string is associated with the specified column, ct_get_format sets outlen to 0.
ct_get_format 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 ct_get_format arguments contains an illegal value. |
ct_get_format returns the user-defined format, if any, for a result column. It indicates how the field should be formatted on screen.
An application can call ct_get_format after ct_results indicates results of type CS_ROW_RESULT.
For a description of how to add user-defined formats to Adaptive Server Enterprise databases or Open Servers, see the Adaptive Server Enterprise and Open Server documentation.
Related functions