Export (0) Print
Expand All

srv_describe

SQL Server 2000

Defines the column name and source and destination data types for a specific column in a row.

Syntax

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

Arguments

srvproc

Is a pointer to the SRV_PROC structure that is the handle for a particular client connection (in this case, the client sending the row). The structure contains all the information that the ODS 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.

column_name

Specifies the name of the column to which the data belongs. This parameter can be NULL because a column is not required to have a name.

namelen

Specifies the length, in bytes, of column_name. If namelen is SRV_NULLTERM, then column_name must be null-terminated.

desttype

Specifies the data type of the destination row column (the data type sent to the client). The data type must be specified even if the data is NULL (see Data Types).

destlen

Specifies the length, in bytes, of the data to be sent to the client. For fixed-length data types that do not allow null values, destlen is ignored. For variable-length data types and fixed-length data types that allow null values, destlen specifies the maximum length the destination data can be.

srctype

Specifies the data type of the source data.

srclen

Specifies the length, in bytes, of the source data. This value is ignored for fixed-length data types.

srcdata

Provides the source data address for a particular column. When srv_sendrow is called, it looks for the data for colnumber at srcdata. Therefore should not be freed before a call to srv_sendrow. The source data address can be changed between calls to srv_sendrow by using srv_setcoldata. Memory allocated for srcdata should not be freed until srv_senddone is called.

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 values you want. You can use DEFAULTPRECISION to specify a default precision, and DEFAULTSCALE to specify a default scale.

Returns

The number of the column 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 result set has been sent, use srv_setcoldata and srv_setcollen, respectively.

For a description of data types and Open Data Services data type conversions, see Data Types.

If the column name in your application is in Unicode, you need to convert it to the multibyte code page of the server before calling srv_describe. For more information, see Unicode Data and Server Code Pages.

See Also

srv_sendrow

srv_setutype

srv_setcoldata

Show:
© 2015 Microsoft