JagContinueWork  JagDisallowCommit

Chapter 5: C Routines Reference

JagDescribeCol

Description

Describe a column to be sent as part of a result set.

Syntax

JagStatus JagDescribeCol(
               SQLSMALLINT  item,
               JagDataType  dataType,
               SQLPOINTER   columnName,
               SQLSMALLINT  SQLDatatype,
               SQLUINTEGER  columnSize,
               SQLUINTEGER  precision,
               SQLSMALLINT  scale,
               SQLSMALLINT  nullable)

Parameters

item

The column number. Column numbers begin with 1.

dataType

One of the following symbolic constants:

JAG_CS_TYPE

To indicate that Sybase Open Client Client-Library datatypes are being used.

JAG_ODBC_TYPE

To indicate that ODBC datatypes are being used.

columnName

A null-terminated string containing the column’s name.

columnDatatype

The ODBC or Client-Library type constant that indicates the column’s datatype. See the “Comments” section below for more information on datatypes.

colLen

The maximum length for column values.

precision

The precision of column values. For SQL_NUMERIC or SQL_DECIMAL columns, precision indicates the maximum number of decimal digits that a value may have. For other datatypes, precision is ignored.

scale

The scale for column values. For SQL_NUMERIC or SQL_DECIMAL columns, scale indicates the number of decimal digits to the right of the decimal point. For other datatypes, scale is ignored.

nullable

One of the following symbolic constants:

Value

To indicate

SQL_NULLABLE

Column can contain null values.

SQL_NO_NULLS

Column values cannot be null.

SQL_NULLABLE_UNKNOWN

Equivalent to SQL_NULLABLE.

Returns

Return value

To indicate

JAG_SUCCEED

Success

JAG_FAIL

Failure

Check the server’s log file for more information when JagDescribeCol fails.

Usage

JagDescribeCol describes the datatype and format of a column to be sent as part of a result set. The JagColAttributes routine specifies additional column metadata.

JagDescribeCol accepts either ODBC or Sybase Open Client type constants. Set the dataType parameter to specify which set of type constants should be used.


ODBC datatypes

When the dataType parameter is JAG_ODBC_TYPE, JagDescribeCol interprets the columnDatatype parameter as an ODBC (sql.h) type constant. The table below lists the supported ODBC SQL type constants. The first column is the SQL type constant and the second is the C datatype constant representing that type.

Table 5-4 describes the supported ODBC C datatypes.

Table 5-4: ODBC datatypes for JagDescribeCol

ODBC SQL type constant

Description

SQL_BINARY, SQL_VARBINARY, SQL_LONGBINARY

An array of bytes.

SQL_CHAR, SQL_VARCHAR,
SQL_LONGVARCHAR

A string of one or more characters.

SQL_DECIMAL

A fixed point, fixed precision, fractional number.

SQL_NUMERIC

Same as SQL_DECIMAL.

SQL_SMALLINT

A 2-byte integer.

SQL_INTEGER

A 4-byte integer.

SQL_REAL

A 4-byte floating point value.

SQL_FLOAT

An 8-byte floating point value.

SQL_TIMESTAMP

An ODBC timestamp value. Timestamps are sent over the network in the same format as SQL_DATE.

SQL_DATE

A date value.

SQL_TIME

A time value.

SQL_BIT

A binary value.

SQL_TINYINT

A one-byte integer.


Client-Library datatypes

When the dataType parameter is JAG_CS_TYPE, JagDescribeCol interprets the columnDatatype parameter as an Open Client Client-Library/C type constant. JagDescribeCol accepts any type constant that can be used with ct_bind. See your Client-Library documentation for descriptions of these datatypes.

See also

JagBeginResults, JagBindCol, JagColAttributes, JagSendData

Chapter 25, “Sending Result Sets,” in the EAServer Programmer’s Guide





Copyright © 2005. Sybase Inc. All rights reserved. JagDisallowCommit