Returns the actual length, in bytes, of the data for a column.
DBINT dbdatlen (
PDBPROCESS dbproc,
INT column );
dbproc
Is 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.
column
Is the number of the column. The first column is number 1. For further information, see dbadata.
The actual length of the data for the particular column. If the data has a null value, 0 is returned. If the column number is not in range, -1 is returned.
The dbcollen function determines the maximum possible length for the data. The data itself is available by calling dbdata. Calling dbdatlen after dbnextrow or dbgetrow returns REG_ROW.
The following example shows how to use 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);
// 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);
}