Return the user-defined datatype for a regular result column.
DBINT dbcolutype(dbproc, column) DBPROCESS *dbproc; int column;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.
The number of the column of interest. The first column is number 1.
column’s user-defined datatype or a negative integer if column is not in range.
dbcolutype returns the user-defined datatype for a regular result column. For a description of how to add user-defined datatypes to Adaptive Server Enterprise databases, see sp_addtype in the Adaptive Server Enterprise Reference Manual.
dbcolutype is defined as datatype DBINT to accommodate the size of user-defined datatypes. Both DBINT and user-defined datatypes are 32 bits long.
The following code fragment illustrates the use of dbcolutype:
DBPROCESS *dbproc;
int colnum;
int numcols;
/* Put the command into the command buffer */
dbcmd(dbproc, "select * from mytable");
/*
** Send the command to the Adaptive Server Enterprise 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));
}