dbaltlen

DB Library for C

DB Library for C

dbaltlen

Returns the maximum length of the data for a compute column.

Syntax

DBINT dbaltlen (
PDBPROCESS
dbproc,
INT
computeid,
INT
column );

Arguments

dbproc

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.

computeid

The ID that identifies the COMPUTE clause. A SELECT statement can have multiple COMPUTE clauses, which can have varying numbers of aggregate operators and aggregate targets. The computeid is returned by dbnextrow or dbgetrow.

column

The number of the column. The first column is number 1.

Returns

The maximum number of bytes that the data can be for a particular column in a compute. When no such column or compute exists, -1 is returned.

Remarks

dbaltlen returns the maximum length, in bytes, for a particular column in a compute row. For variable-length data, this is not necessarily the actual length of the data, but rather the maximum length. Calling dbaltlen only after dbnextrow or dbgetrow returns a computeid. For the actual data length, use dbadlen.

Examples

After the following SELECT statement, calling dbaltlen(dbproc, 1, 1) returns 4, because counts are of SQLINT4 type, which is 4 bytes long:

SELECT dept, name FROM employee
ORDER BY dept, name
COMPUTE COUNT(name) BY dept

See Also

dbadata

dbgetrow

dbadlen

dbnextrow

dbalttype

dbnumalts