dbnumalts

Description

Return the number of columns in a compute row.

Syntax

int dbnumalts(dbproc, computeid)
 
DBPROCESS    *dbproc;
int                        computeid;

Parameters

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.

computeid

The ID that identifies the particular compute row of interest. A SQL select statement may have multiple compute clauses, each of which returns a separate compute row. The computeid corresponding to the first compute clause in a select is 1. The computeid is returned by dbnextrow or dbgetrow.

Returns

The number of columns for the particular computeid. dbnumalts returns -1 if computeid is invalid.

Usage

dbnumalts returns the number of columns in a compute row. The application can call this routine after dbresults returns SUCCEED. For example, in the following SQL statement the call dbnumalts(dbproc, 1) returns 3:

select dept, year, sales from employee 
order by dept, year 
compute avg(sales), min(sales), 
max(sales) by dept 

See also

dbadata, dbadlen, dbaltlen, dbalttype, dbgetrow, dbnextrow, dbnumcols