Returns the actual length, in bytes, of the data for a column.
DBINT dbdatlen (
PDBPROCESS dbproc,
INT column );
where
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); }
dbcollen, dbcolname, dbcoltype, dbdata, dbnumcols