home *** CD-ROM | disk | FTP | other *** search
-
- 1 Version 4.0 -- 5/1/89 dbcoltype
- ______________________________________________________________________
-
- NAME: dbcoltype
-
- FUNCTION:
- Return the datatype for a regular result column.
-
- SYNTAX:
- int dbcoltype(dbproc, column)
-
- DBPROCESS *dbproc;
- int column;
-
- COMMENTS:
-
-
-
-
-
-
-
- dbcoltype Version 4.0 -- 5/1/89 2
- ______________________________________________________________________
-
- o This routine returns the datatype for a regular (i.e., non-
- compute) result column. For a list of SQL Server datatypes,
- see the manual page for types.
- o dbcoltype() actually returns an integer token value for the
- datatype (SYBCHAR, SYBFLT8, etc.). To convert the token value
- into a readable token string, use dbprtype(). See the
- dbprtype() manual page for a list of all token values and their
- equivalent token strings.
-
- o You can use dbvarylen() to determine whether a column's data-
- type is variable length.
- o Here's a program fragment that uses dbcoltype():
-
- DBPROCESS *dbproc;
- int colnum;
- int coltype;
-
-
-
- 3 Version 4.0 -- 5/1/89 dbcoltype
- ______________________________________________________________________
-
- /* 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 types */
- for (colnum = 1; colnum < 4; colnum++)
- {
- coltype = dbcoltype(dbproc, colnum);
- printf("column %d, type is %s.\n", colnum,
- dbprtype(coltype));
- }
-
-
-
- dbcoltype Version 4.0 -- 5/1/89 4
- ______________________________________________________________________
-
-
- PARAMETERS:
- dbproc - A pointer to the DBPROCESS structure that provides the
- connection for a particular front-end/SQL Server process. It
- contains all the information that DB-Library uses to manage
- communications and data between the front end and SQL Server.
- column - The number of the column of interest. The first column
- is number 1.
-
- RETURNS:
- A token value for the datatype for a particular column.
-
- In a few cases, the token value returned by this routine may not
- correspond exactly with the column's SQL Server datatype:
- o SYBVARCHAR is returned as SYBCHAR.
-
- o SYBVARBINARY is returned as SYBBINARY.
-
-
- 5 Version 4.0 -- 5/1/89 dbcoltype
- ______________________________________________________________________
-
- o SYBDATETIMN is returned as SYBDATETIME.
- o SYBMONEYN is returned as SYBMONEY.
-
- o SYBFLTN is returned as SYBFLT8.
- o SYBINTN is returned as SYBINT1, SYBINT2, or SYBINT4, depending
- on the actual type of the SYBINTN.
-
- If the column number is not in range, dbcoltype() returns -1.
-
- SEE ALSO:
- dbcollen, dbcolname, dbdata, dbdatlen, dbnumcols, dbprtype,
- dbvarylen, types
-
-
-
-
-
-
-