Hitachi

Hitachi Advanced Database Application Development Guide


16.17 Attributes that can be specified in SQLGetDescField, SQLGetDescFieldW, SQLSetDescField, and SQLSetDescFieldW

The following table lists and describes the attributes that can be specified in SQLGetDescField, SQLGetDescFieldW, SQLSetDescField, and SQLSetDescFieldW.

Table 16‒22: Values of header fields in a descriptor

No.

Attribute

Description (convention)

Support status

Data type

1

SQL_DESC_ALLOC_TYPE

Whether the descriptor was allocated automatically or explicitly.

SQL_DESC_ALLOC_AUTO

The descriptor was allocated automatically by the driver.

SQL_DESC_ALLOC_USER

The descriptor was allocated explicitly by the application.

Supports the following values:

  • SQL_DESC_ALLOC_AUTO

  • SQL_DESC_ALLOC_USER

SQLSMALLINT

2

SQL_DESC_ARRAY_SIZE

ARD

Number of rows in the row set (value returned by SQLFetch).

APD

Number of values for each parameter.

Supports the following value:

  • 1

SQLULEN

3

SQL_DESC_ARRAY_STATUS_PTR

IRD

Pointer to a row status array containing status values after an execution of SQLFetch.

IPD

Pointer to a parameter status array containing status information for each set of parameter values after an execution of SQLExecute, SQLExecDirect, or SQLExecDirectW.

ARD

Pointer to an operation array in which the application can set a value to specify that rows are to be ignored for SQLSetPos processing.

APD

Pointer to a parameter operation array in which the application can set a value to specify that parameter sets are to be ignored during an execution of SQLExecute, SQLExecDirect, or SQLExecDirectW.

NULL

The driver does not store status values or status information, nor does it ignore rows or parameter sets.

Supports the following value:

  • NULL

SQLUSMALLINT *

4

SQL_DESC_BIND_OFFSET_PTR

Binding offset specified by the application program.

This value is added to the delay field during a fetch operation.

NULL

The driver does not add the value.

Supports the following value:

  • NULL

SQLLEN *

5

SQL_DESC_BIND_TYPE

Binding orientation for columns or parameters.

ARD

Binding orientation during an execution of SQLFetch.

APD

Binding orientation for dynamic parameters.

SQL_BIND_BY_COLUMN

Specifies column-wise binding.

Supports the following value:

  • SQL_BIND_BY_COLUMN

SQLINTEGER

6

SQL_DESC_COUNT

Highest number of the record that stores data.

The permitted value is 1 or greater.

Supports the following values:

  • Integer value of 0 or greater

SQLSMALLINT

7

SQL_DESC_ROWS_PROCESSED_PTR

IRD

Pointer to the buffer that stores the number of fetched rows after an execution of SQLFetch.

IPD

Pointer to the buffer that stores the number of parameter sets processed during an execution of SQLExecute, SQLExecDirect, or SQLExecDirectW.

NULL

The driver does not store the number of fetched rows or the number of parameter sets.

Supports the following value:

  • NULL

SQLULEN *

Table 16‒23: Values of record fields in a descriptor

No.

Attribute

Description (convention)

Support status

Data type

1

SQL_DESC_AUTO_UNIQUE_VALUE

Whether columns are incremented automatically.

SQL_FALSE

Columns are not incremented automatically.

Supports the following value:

  • SQL_FALSE

SQLINTEGER

2

SQL_DESC_BASE_COLUMN_NAME

Base column name for the result set column.

Supports the following values:

  • Column name.

  • "EXPnnnn_NO_NAME" (nnnn: Unsigned integer in the range from 0001 to 1000)

    The retrieval item column is not a column specification.

  • SQLCHAR *

  • SQLWCHAR *

3

SQL_DESC_BASE_TABLE_NAME

Base table name for the result set column.

Supports the following value:

  • Null character string

  • SQLCHAR *

  • SQLWCHAR *

4

SQL_DESC_CASE_SENSITIVE

Whether the column or parameter is treated as being case-sensitive during collations or comparisons.

SQL_TRUE

The column or parameter is treated as being case-sensitive during collations or comparisons.

SQL_FALSE

One of the following:

The column or parameter is not treated as being case-sensitive.

It is a noncharacter column.

Supports the following values:

  • SQL_TRUE

  • SQL_FALSE

SQLINTEGER

5

SQL_DESC_CATALOG_NAME

Catalog name for the base table that contains the column.

Supports the following value:

  • Null character string

  • SQLCHAR *

  • SQLWCHAR *

6

SQL_DESC_CONCISE_TYPE

Concise data type for all data types.

Supports the following value:

  • The data types supported by this driver.

SQLSMALLINT

7

SQL_DESC_DATA_PTR

Pointer to the buffer that stores the parameter value (APD) or column value (ARD).

Supports the following values:

  • NULL

  • Pointer to the buffer

SQLPOINTER

8

SQL_DESC_DATETIME_INTERVAL_CODE

Subcode for the specific datetime or interval data type when the SQL_DESC_TYPE field value is SQL_DATETIME or SQL_INTERVAL.

Otherwise, this field is 0.

Supports the following values:

  • Subcode for the specific datetime or interval data type.

  • 0

SQLSMALLINT

9

SQL_DESC_DATETIME_INTERVAL_PRECISION

Interval leading precision when the SQL_DESC_TYPE field is SQL_INTERVAL.

Otherwise, this field is 0.

Supports the following value:

  • 0

SQLINTEGER

10

SQL_DESC_DISPLAY_SIZE

Maximum number of characters required to display the data from the column.

Supports the following values according to the data type:

  • SQL_CHAR, SQL_VARCHAR

    Definition length (in bytes).

  • SQL_BIGINT, SQL_INTEGER

    Number of digits.

  • SQL_DECIMAL

    Precision (total number of digits) + 2

  • SQL_TYPE_DATE, SQL_DATE

    10.

  • SQL_TYPE_TIME, SQL_TIME

    8 + (p + 1)#.

  • SQL_TYPE_TIMESTAMP, SQL_TIMESTAMP

    19 + (p + 1)#.

  • SQL_DOUBLE

    24.

  • SQL_BINARY, SQL_VARBINARY

    Definition length (in bytes) × 2.

SQLLEN

11

SQL_DESC_FIXED_PREC_SCALE

Whether the column is an exact numeric column.

SQL_FALSE

The column is not an exact numeric column with a fixed precision and scale set.

Supports the following value:

  • SQL_FALSE

SQLSMALLINT

12

SQL_DESC_INDICATOR_PTR

Whether the column or parameter value is NULL.

Supports the following values:

  • NULL

  • Pointer to the buffer

SQLLEN *

13

SQL_DESC_LABEL

Column label or title.

Supports the following values:

  • Column name.

  • "EXPnnnn_NO_NAME" (nnnn: Unsigned integer in the range from 0001 to 1000)

    The retrieval item column is not a column specification.

  • SQLCHAR *

  • SQLWCHAR *

14

SQL_DESC_LENGTH

Maximum or actual length of a character string or a binary data type.

Supports the following value:

  • Definition length of each data type (in bytes).

SQLULEN

15

SQL_DESC_LITERAL_PREFIX

The character or characters that the driver recognizes as a prefix for a data-type literal.

Supports the following value:

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

16

SQL_DESC_LITERAL_SUFFIX

The character or characters that the driver recognizes as a suffix for a data-type literal.

Supports the following value:

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

17

SQL_DESC_LOCAL_TYPE_NAME

Localized name for the data type that differs from the regular name of the data type.

Supports the following value:

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

18

SQL_DESC_NAME

Column alias. If the column alias does not apply, this is the column name.

Supports the following values:

  • Column name.

  • "EXPnnnn_NO_NAME" (nnnn: Unsigned integer in the range from 0001 to 1000)

    The retrieval item column is not a column specification.

  • SQLCHAR *

  • SQLWCHAR *

19

SQL_DESC_NULLABLE

Whether NULL can be specified for the column.

SQL_NULLABLE

NULL values can be specified for the column.

SQL_NO_NULLS

NULL values cannot be specified for the column.

Supports the following values:

  • SQL_NULLABLE

  • SQL_NO_NULLS

SQLSMALLINT

20

SQL_DESC_NUM_PREC_RADIX

Whether the data type of the SQL_DESC_TYPE field is an approximate value data type or an exact numeric value data type.

10

Exact numeric value data type.

0

Nonnumeric data type.

Supports the following values:

  • 10

  • 0

SQLINTEGER

21

SQL_DESC_OCTET_LENGTH

Length in bytes of a character string or binary data type.

Supports the following value:

  • Definition length of each data type (in bytes).

SQLLEN

22

SQL_DESC_OCTET_LENGTH_PTR

Variable that contains the total length in bytes of a dynamic argument (for parameter descriptors) or a bound column value (for row descriptors).

Supports the following values:

  • NULL

  • Pointer to the buffer

SQLLEN *

23

SQL_DESC_PARAMETER_TYPE

Parameter type (input, output, or input/output).

SQL_PARAM_INPUT

Input parameter.

SQL_PARAM_INPUT_OUTPUT

Input/output parameter.

Supports the following values:

  • SQL_PARAM_INPUT

  • SQL_PARAM_INPUT_OUTPUT

    Replaced with SQL_PARAM_INPUT.

SQLSMALLINT

24

SQL_DESC_PRECISION

Number of digits for an exact numeric type and the number of bits in the mantissa (binary precision) for an approximate value type.

Supports the following values according to the data type:

  • SQL_BIGINT, SQL_INTEGER

    Number of digits.

  • SQL_DECIMAL

    Precision (total number of digits).

  • SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, SQL_TIME, SQL_TIMESTAMP

    Fractional seconds precision.

  • SQL_DOUBLE

    15.

  • Other data type

    0.

SQLSMALLINT

25

SQL_DESC_SCALE

Defined scale for decimal and numeric data types.

Defined scale.

Supports the following values:

  • Defined scale.

  • 0

    Nonnumeric data type.

SQLSMALLINT

26

SQL_DESC_SCHEMA_NAME

Schema name of the base table that stores the column.

Supports the following value:

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

27

SQL_DESC_SEARCHABLE

Whether the column can be used in a WHERE clause.

SQL_PRED_SEARCHABLE

The column can be used in any comparison operator in a WHERE clause.

Supports the following value:

  • SQL_PRED_SEARCHABLE

SQLSMALLINT

28

SQL_DESC_TABLE_NAME

Name of the base table that stores the column.

Supports the following value:

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

29

SQL_DESC_TYPE

  • All data types except datetime and interval.

    Concise SQL data type or concise C data type.

  • Datetime and interval data types.

    Redundant data type (SQL_DATETIME or SQL_INTERVAL).

Supports the following values:

  • Concise SQL data type.

  • Concise C data type.

  • Redundant data type.

SQLSMALLINT

30

SQL_DESC_TYPE_NAME

Data type name that depends on the data source.

If the data type is unknown, a null character string is specified.

Supports the following values:

  • Data type name that depends on the data source.

  • Null character string.

  • SQLCHAR *

  • SQLWCHAR *

31

SQL_DESC_UNNAMED

Whether a column name or a column alias was specified in the SQL_DESC_NAME field.

SQL_NAMED

A column name or a column alias was specified in the SQL_DESC_NAME field.

SQL_UNNAMED

A column name or a column alias was not specified in the SQL_DESC_NAME field.

Supports the following values:

  • SQL_NAMED

  • SQL_UNNAMED

SQLSMALLINT

32

SQL_DESC_UNSIGNED

Whether the column's data type is signed or unsigned.

SQL_TRUE

The column's data type is unsigned or nonnumeric.

SQL_FALSE

The column's data type is signed.

Supports the following values:

  • SQL_TRUE

  • SQL_FALSE

SQLSMALLINT

33

SQL_DESC_UPDATABLE

Whether the column in the result set can be updated.

SQL_ATTR_READWRITE_UNKNOWN

Whether the column in the result set can be updated is unknown.

Supports the following value:

  • SQL_ATTR_READWRITE_UNKNOWN

SQLSMALLINT

34

SQL_COLUMN_LENGTH

A field defined in ODBC 2.0.

Supports the following values according to the data type:

  • SQL_CHAR, SQL_VARCHAR, SQL_BINARY, SQL_VARBINARY

    Definition length (in bytes).

  • SQL_BIGINT, SQL_INTEGER

    Number of digits.

  • SQL_DECIMAL

    Precision (total number of digits) + 2

  • SQL_TYPE_DATE

    10.

  • SQL_TYPE_TIME, SQL_TIME

    8 + (p + 1)#.

  • SQL_TYPE_TIMESTAMP, SQL_TIMESTAMP

    19 + (p + 1)#.

  • SQL_DOUBLE

    24.

SQLLEN

35

SQL_COLUMN_PRECISION

A field defined in ODBC 2.0.

Supports the following values:

  • Same values as for SQL_DESC_PRECISION.

SQLSMALLINT

36

SQL_COLUMN_SCALE

A field defined in ODBC 2.0.

Supports the following values:

  • Same values as for SQL_DESC_SCALE.

SQLSMALLINT

#

p indicates the fractional seconds precision with a maximum length of 12 digits.

If there is a fractional second, add the value in parentheses.