Returns the maximum length, in bytes, of the data for a column.
DBINT dbcollen (
PDBPROCESS dbproc,
INT column );
where
The maximum length of the data for the particular column. If the column number is not in range, -1 is returned.
In the case of variable length data, the maximum length 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. Call dbcollen after dbresults returns SUCCEED.
The following example shows how to use 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); // 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); }
dbcolname, dbcoltype, dbdata, dbdatlen, dbnumcols