1 Version 4.0 -- 5/1/89 dbdatlen
______________________________________________________________________
NAME: dbdatlen
FUNCTION:
Return the length of the data in a regular result column.
SYNTAX:
DBINT dbdatlen(dbproc, column)
DBPROCESS *dbproc;
int column;
COMMENTS:
dbdatlen Version 4.0 -- 5/1/89 2
______________________________________________________________________
o This routine returns the actual length of the data for a regu-
lar (i.e., non-compute) result column.
o Use the dbcollen() routine to determine the maximum possible
length for the data. Use dbdata() to get a pointer to the data
itself.
o Here's a small program fragment that uses dbdatlen():
DBPROCESS *dbproc;
DBINT row_number = 0;
DBINT data_length;
/* put the command into the command buffer */
dbcmd(dbproc, "select name from sysobjects");
/* send the command to SQL Server and begin execution */
dbsqlexec(dbproc);
3 Version 4.0 -- 5/1/89 dbdatlen
______________________________________________________________________
/* process the command results */
dbresults(dbproc);
/* examine the data lengths of each row */
while (dbnextrow(dbproc) != NO_MORE_ROWS)
{
row_number++;
data_length = dbdatlen(dbproc, 1);
printf("row %ld, data length is %ld.\n", row_number,
data_length);
}
PARAMETERS:
dbproc - A pointer to the DBPROCESS structure that provides the
connection for a particular front-end/SQL Server process. It
dbdatlen Version 4.0 -- 5/1/89 4
______________________________________________________________________
contains all the information that DB-Library uses to manage
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 length, in bytes, of the data for the particular column. If
the data has a null value, dbdatlen() returns 0. If the column
number is not in range, dbdatlen() returns -1.
SEE ALSO:
dbcollen, dbcolname, dbcoltype, dbdata, dbnumcols