1 Version 4.0 -- 5/1/89 dbcollen
______________________________________________________________________
NAME: dbcollen
FUNCTION:
Return the maximum length of the data in a regular result column.
SYNTAX:
DBINT dbcollen(dbproc, column)
DBPROCESS *dbproc;
int column;
COMMENTS:
dbcollen Version 4.0 -- 5/1/89 2
______________________________________________________________________
o This routine returns the maximum length of the data in a regu-
lar (i.e., non-compute) result column. In the case of variable
length data, this is not necessarily the actual length of the
data, but rather the maximum length that the data can be. For
the actual data length, use dbdatlen().
o Here's a small program fragment that uses dbcollen():
DBPROCESS *dbproc;
int colnum;
DBINT column_length;
/* put the command into the command buffer */
dbcmd(dbproc, "select name, id, type from sysobjects");
/* send the command to SQL Server and begin execution */
dbsqlexec(dbproc);
3 Version 4.0 -- 5/1/89 dbcollen
______________________________________________________________________
/* process the command results */
dbresults(dbproc);
/* examine the column lengths */
for (colnum = 1; colnum < 4; colnum++)
{
column_length = dbcollen(dbproc, colnum);
printf("column %d, length is %ld.\n", colnum,
column_length);
}
PARAMETERS:
dbproc - A pointer to the DBPROCESS structure that provides the
connection for a particular front-end/SQL Server process. It
contains all the information that DB-Library uses to manage
dbcollen Version 4.0 -- 5/1/89 4
______________________________________________________________________
communications and data between the front end and SQL Server.
column - The number of the column of interest. The first column
is number 1.
RETURNS:
The maximum length, in bytes, of the data for the particular
column. If the column number is not in range, dbcollen() returns
-1.
SEE ALSO:
dbcolname, dbcoltype, dbdata, dbdatlen, dbnumcols