Hitachi

Hitachi Advanced Database Application Development Guide


16.4.5 SQLGetTypeInfo, SQLGetTypeInfoW

Organization of this subsection

(1) Function

This ODBC function returns information about the data types supported by the HADB ODBC driver as a result set for the specified SQL statement.

(2) Format

(3) Arguments

StatementHandle

Specifies a statement handle.

DataType

Specifies an SQL data type identifier. Specify as explained below, depending on the data to be acquired:

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_ERROR, or SQL_INVALID_HANDLE.

When SQLGetTypeInfo or SQLGetTypeInfoW is executed, a result set is created. The following table shows the format of the result set that is returned.

Table 16‒4: Format of the ResultSet object that is returned

Column No.

Type

Column name

Description

1

Varchar

TYPE_NAME

HADB data type name

2

Smallint

DATA_TYPE

ODBC SQL data type

3

Integer

COLUMN_SIZE

Column size

4

Varchar

LITERAL_PREFIX

Prefix used to quote a literal

5

Varchar

LITERAL_SUFFIX

Suffix used to quote a literal

6

Varchar

CREATE_PARAMS

Parameters used to create types

7

Smallint

NULLABLE

Returns a value indicating whether the null value can be used.

The function always returns SQL_NULLABLE_UNKNOWN.

8

Smallint

CASE_SENSITIVE

Returns a value indicating whether the data type is case-sensitive.

  • SQL_TRUE: Character string data type

  • SQL_FALSE: Other data type

9

Smallint

SEARCHABLE

Returns a value indicating how the data type is used in WHERE.

The function always returns SQL_SEARCHABLE.

10

Smallint

UNSIGNED_ATTRIBUTE

Returns a value indicating whether the data type has the unsigned attribute.

  • SQL_FALSE: Numeric data type (because the data type is signed)

  • Null value: Other data type

11

Smallint

FIXED_PREC_SCALE

Returns a value indicating whether the data type can be a currency value.

The function always returns SQL_FALSE.

12

Smallint

AUTO_UNIQUE_VALUE

Returns a value indicating whether the data type can be used for autoincrementing values.

The function always returns a null value.

13

Varchar

LOCAL_TYPE_NAME

Localized version of the type name.

The function returns the same name as the type name.

14

Smallint

MINIMUM_SCALE

Minimum scale supported.

If scale is not applicable, the function returns a null value.

15

Smallint

MAXIMUM_SCALE

Maximum scale supported.

If scale is not applicable, the function returns a null value.

16

Smallint

SQL_DATA_TYPE

ODBC SQL data type that is set in the SQL_DESC_TYPE field.

17

Smallint

SQL_DATETIME_SUB

Date-time subcode.

If the data type is not datetime, the function returns a null value.

18

Integer

NUM_PREC_RADIX

  • 10: Numeric data type

  • Null value: Other data type

19

Smallint

INTERVAL_PRECISION

The function always returns a null value.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

01S02

Option value changed

N

08S01

Communication link failure

N

24000

Invalid cursor status

N

40001

Serialization failure

N

40003

Statement completion unknown

N

HY000

General error

N

HY001

Memory allocation error

Y

HY004

Invalid SQL data type

Y

HY008

Operation cancelled

N

HY010

Function sequence error

Y

HY013

Memory management error

N

HY117

Connection suspended

N

HYC00

Optional feature not implemented

N

HYT00

Timeout expired

N

HYT01

Connection timeout expired

N

IM001

Driver does not support this function

N

IM017

Invalid asynchronous polling

N

IM018

Incomplete asynchronous execution

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None