Determine the number of regular columns for the current set of results.
int dbnumcols(dbproc) DBPROCESS *dbproc;
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 columns in the current set of results. If there are no columns, dbnumcols returns 0.
dbnumcols returns the number of regular (that is, non-compute) columns in the current set of results.
Here is a program fragment that illustrates the use of dbnumcols:
int column_count;
DBPROCESS *dbproc;
/* Put the commands into the command buffer */
dbcmd(dbproc, "select name, id, type from \
sysobjects");
dbcmd(dbproc, " select name from sysobjects");
/*
** Send the commands to Adaptive Server Enterprise and start
** execution
*/
dbsqlexec(dbproc);
/* Process each command until there are no more */
while (dbresults(dbproc) != NO_MORE_RESULTS)
{
column_count = dbnumcols(dbproc);
printf("%d columns in this Adaptive Server Enterprise \
result.\n", column_count);
while (dbnextrow(dbproc) != NO_MORE_ROWS)
printf("row received.\n");
}