dbcolutype

DB Library for C

DB Library for C

dbcolutype

Returns the user-defined data type for a regular result column.

Syntax

DBINT dbcolutype (
PDBPROCESS
dbproc,
INT
column );

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.

column

Is the number of the column. The first column is number 1. For further information, see dbadata.

Returns

The column parameter's user-defined data type on success and -1 on error.

Remarks

This function is defined as data type DBINT to accommodate the size of user-defined data types. Both DBINT and user-defined data types are 32 bits long. Call dbcolutype after dbresults returns SUCCEED.

Example

This example shows how to use dbcolutype:

DBPROCESS   *dbproc;
int         colnum;
int         numcols;

// Put the command into the command buffer.
dbcmd (dbproc, "SELECT * FROM mytable");

// Send the command to the SQL Server and begin execution. 
dbsqlexec(dbproc);

// Process the command results. 
dbresults(dbproc);
// Examine the user-defined column types. 
numcols = dbnumcols(dbproc);
for (colnum = 1; colnum < numcols; colnum++)
{
     printf
     ("column %d, user-defined type is %ld.\n",
     colnum, dbcolutype(dbproc, colnum));
}

See Also

dbaltutype

dbcoltype