Return the datatype for a compute column.
int dbalttype(dbproc, computeid, column) DBPROCESS *dbproc; int computeid; 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 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.
The number of the column of interest. The first column is number 1.
A token value for the datatype for a particular compute column.
In a few cases, the token value returned by this routine may not correspond exactly with the column’s server datatype:
SYBVARCHAR is returned as SYBCHAR.
SYBVARBINARY is returned as SYBBINARY.
SYBDATETIMN is returned as SYBDATETIME.
SYBMONEYN is returned as SYBMONEY.
SYBFLTN is returned as SYBFLT8.
SYBINTN is returned as SYBINT1, SYBINT2, or SYBINT4, depending on the actual type of the SYBINTN.
dbalttype returns -1 if either the computeid or the column value is invalid.
This routine returns the datatype for a compute column. For a list of server datatypes, see Types.
dbalttype actually returns an integer token value for the datatype (SYBCHAR, SYBFLT8, and so on). To convert the token value into a readable token string, use dbprtype. See the dbprtype reference page for a list of all token values and their equivalent token strings.
For example, given the SQL statement:
select dept, name from employee
order by dept, name
compute count(name) by dept
the call dbalttype(dbproc, 1, 1) returns the token value SYBINT4, because counts are of SYBINT4 type. dbprtype will convert SYBINT4 into the readable token string “int”.
dbadata, dbadlen, dbaltlen, dbnextrow, dbnumalts, dbprtype, Types