dbcolinfo

Returns information about a regular column or a compute column in a result set, or a column in a cursor.

Syntax

RETCODE dbcolinfo (
PDBHANDLE
pdbhandle,
INT
type,
DBINT
column,
DBINT
computeid,
LPDBCOL
lpdbcol );

where

pdbhandle
Is a DBPROCESS pointer or a cursor handle. If type is CI_REGULAR or CI_ALTERNATE, this is a DBPROCESS pointer. If type is CI_CURSOR, this is a DBCURSOR handle.
type
Is the type of column information to return. The following table describes the different type values:
type Description
CI_REGULAR Return information about a regular column in the current result set.
CI_ALTERNATE Returns information about a compute column in the current result set.
CI_CURSOR Returns information about a column in the open cursor.

column
Is the number of the column. The first column is number 1.
computeid
If type is CI_ALTERNATE, this is the ID that identifies the compute (the result of a COMPUTE clause) value. The computeid is returned by dbnextrow or dbgetrow. If type is not CI_ALTERNATE, specify 0.
lpdbcol
Is a pointer to a DBCOL structure that DB-Library will fill with detailed information about the specified column.

The DBCOL structure is defined as follows:

typedef struct
{
    DBINT SizeOfStruct;
    CHAR  Name[MAXCOLNAMELEN+1]
    CHAR  ActualName[MAXCOLNAMELEN+1]
    CHAR  TableName[MAXTABLENAME+1]
    SHORT Type;
    DBINT UserType;
    DBINT MaxLength;
    BYTE  Precision;
    BYTE  Scale;
    BOOL  VarLength;
    BYTE  Null;
    BYTE  CaseSensitive;
    BYTE  Updatable;
    BOOL  Identity;
} DBCOL, PTR LPDBCOL;

The DBCOL fields (and the equivalent DB-Library functions, if any) are described below:
Field Description
SizeOfStruct Before calling dbcolinfo, set this field equal to the value returned by the C sizeof function for the DBCOL structure.
Name Is the name of the returned column (dbcolname).
ActualName Is the actual name of the column in TableName if type is CI_CURSOR; otherwise, this is the same as Name.
TableName Is the table that contains the column if type is CI_CURSOR; otherwise, NULL.
Type Is the datatype of the column (dbcoltype, dbalttype).
UserType Is the user-defined datatype of the column (dbcolutype, dbaltutype).
MaxLength Is the maximum length, in bytes, of the column (dbcollen, dbaltlen).
Precision The precision if Type is SQLDECIMAL or SQLNUMERIC; otherwise, - 1.
Scale The scale if Type is SQLDECIMAL or SQLNUMERIC; otherwise, - 1.
VarLength Is one of the following (dbvarylen):

TRUE if the column is variable-length.

FALSE if the column is fixed-length.

Null Is one of the following:

TRUE if the column allows nulls.

FALSE if the column does not allow nulls.

DBUNKNOWN if nullability is unknown.

CaseSensitive Is one of the following:

TRUE if the column is case sensitive.

FALSE if the column is case insensitive.

DBUNKNOWN if case sensitivity is unknown.

Updatable Is one of the following:

TRUE if the column can be changed.

FALSE if the column is read-only and cannot be changed.

DBUNKNOWN if updatability is unknown.

Identity Is one of the following:

TRUE if the column is an identity column.

FALSE if the column is not an identity column.


Returns

SUCCEED or FAIL.

Remarks

Before calling dbcolinfo, set the SizeOfStruct field equal to the value returned by the C sizeof function for the DBCOL structure. The dbcolinfo function fills the supplied DBCOL structure with information about the specified column.

Call this function after dbresults returns SUCCEED, or after dbcursoropen returns a cursor handle.

See Also

dbaltlen, dbalttype, dbaltutype, dbcollen, dbcolname, dbcoltype, dbcolutype, dbvarylen