srv_describe

Defines a row's column name, and source and destination datatypes.

Syntax

int srv_describe (
SRV_PROC *
srvproc,
int
colnumber,
DBCHAR *
columnname,
int
namelen,
DBINT
desttype,
DBINT
destlen,
DBINT
srctype,
DBINT
srclen,
void *
srcdata );

where

srvproc
Is a pointer to the SRV_PROC structure that is the handle for a particular client connection (in this case, the client that is sending the row). The structure contains all the information that the Data Services Library uses to manage communications and data between the Open Data Services server application and the client.
colnumber
Is currently not supported. Columns must be described in order. All columns must be described before srv_sendrow is called.
columnname
Specifies the name of the column to which the data belongs. This parameter can be NULL, since a column is not required to have a name.
namelen
Specifies the length, in bytes, of columnname. If namelen is SRV_NULLTERM, then the columname string must be null-terminated.
desttype
Specifies the datatype of the destination row column (the datatype sent to the client). The datatype must be specified even if the data is NULL (see Datatypes.)
destlen
Specifies the length, in bytes, of the data to be sent to the client. For fixed-length datatypes that don't allow null values, destlen is ignored. For variable-length datatypes and fixed-length datatypes that allow null values, destlen specifies the maximum length that the destination data can be.
srctype
Specifies the datatype of the source data.
srclen
Specifies the length, in bytes, of the source data. This value is ignored for fixed-length datatypes.
srcdata
Provides the source data address for a particular column. When srv_sendrow is called, it looks for the data for colnumber at srcdata. The source data address can be changed between calls to srv_sendrow by using srv_setcoldata.

If desttype is SRVDECIMAL or SRVNUMERIC, the srcdata parameter must be a pointer to a DBNUMERIC or DBDECIMAL structure with the precision and scale fields of the structure already set to the desired values. You can use DEFAULTPRECISION to specify a default precision and DEFAULTSCALE to specify a default scale.

Returns

The number of the column that has been described. The first column is column 1. If an error occurs, returns 0.

Remarks

The srv_describe function must be called once for each column in the row before the first call to srv_sendrow. The columns of a row can be described in any order.

To change the location and length of the source data in column rows before the complete results set has been sent, use srv_setcoldata and srv_setcollen, respectively.

The ODS Library automatically performs data conversion between srctype and desttype.

See Also

This entry For information about
srv_convert Converting datatypes and supported conversions
srv_sendrow Sending rows to a client
srv_setcoldata Setting the address for a column's data
srv_setutype Setting datatype columns in rows and datatypes that are available