dbdatlen

Returns the actual length, in bytes, of the data for a column.

Syntax

DBINT dbdatlen (
PDBPROCESS
dbproc,
INT
column );

Arguments
dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ Microsoft® SQL Server™ 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.
Returns

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.

Remarks

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.

Examples

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);
}

  

See Also
dbcollen dbdata
dbcolname dbnumcols
dbcoltype  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.