srv_describe (Extended Stored Procedure API)
Applies to: SQL Server
Important
This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use CLR integration instead.
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 Extended Stored Procedure API library uses to manage communications and data between the 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. This is the data type sent to the client. The data type must be specified even if the data is NULL, for more information, see Data Types (Extended Stored Procedure API).
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 it 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 the column data is replaced by another call to srv_setcoldata, or 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 Extended Store Procedure API data type conversions, see Data Types (Extended Stored Procedure API).
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.
Important
You should thoroughly review the source code of extended stored procedures, and you should test the compiled DLLs before you install them on a production server. For information about security review and testing, see this Microsoft Web site.
See Also
srv_sendrow (Extended Stored Procedure API)
srv_setutype (Extended Stored Procedure API)
srv_setcoldata (Extended Stored Procedure API)