Hitachi

Hitachi Advanced Database Application Development Guide


15.5.1 Correspondence between ODBC's SQL data types and HADB's data types

The following table shows the correspondence between ODBC's SQL data types and HADB's data types.

Table 15‒3: Correspondence between ODBC's SQL data types and HADB's data types

Classification

ODBC's SQL data type

HADB's corresponding data type

Description

Supported

Character string data

SQL_CHAR

CHARACTER

Fixed-length character string

Y

SQL_VARCHAR

VARCHAR

Variable-length character string

Y

SQL_LONGVARCHAR

STRING

Variable-length character string

Y

SQL_WCHAR

CHARACTER

Fixed-length character string (for Unicode)

Y

SQL_WVARCHAR

VARCHAR

Variable-length character string (for Unicode)

Y

SQL_WLONGVARCHAR

STRING

Variable-length character string (for Unicode)

Y

Numeric data

SQL_DECIMAL

DECIMAL, NUMERIC

Fixed-point number

Y

SQL_NUMERIC

DECIMAL, NUMERIC

Fixed-point number

Y

SQL_TINYINT

--

1-byte integer

N

SQL_SMALLINT

SMALLINT

2-byte integer

Y#1

SQL_INTEGER

INTEGER#3

4-byte integer

Y

SQL_BIGINT

BIGINT#4

8-byte integer

Y

SQL_REAL

REAL

Single-precision floating point number

Y

SQL_FLOAT

DOUBLE PRECISION, FLOAT

Double-precision floating-point number

Y

SQL_DOUBLE

DOUBLE PRECISION, FLOAT

Double-precision floating-point number

Y

SQL_BIT

BOOLEAN

Bit (logical data)

Y

SQL_BINARY

BINARY

Fixed-length binary data

Y

SQL_VARBINARY

VARBINARY

Variable-length binary data

Y

SQL_LONGVARBINARY

--

Variable-length binary data

N

Date and time data

SQL_TYPE_DATE(, SQL_DATE)#2

DATE

Date

Y

SQL_TYPE_TIME(, SQL_TIME)#2

TIME

Time

Y

SQL_TYPE_TIMESTAMP(, SQL_TIMESTAMP)#2

TIMESTAMP

Time stamp

Y

SQL_INTERVAL_MONTH

--

Interval in months

N

SQL_INTERVAL_YEAR

--

Interval in years

N

SQL_INTERVAL_YEAR_TO_MONTH

--

--

N

SQL_INTERVAL_DAY

--

Interval in days

N

SQL_INTERVAL_HOUR

--

Interval in hours

N

SQL_INTERVAL_MINUTE

--

Interval in minutes

N

SQL_INTERVAL_SECOND

--

Interval in seconds

N

SQL_INTERVAL_DAY_TO_HOUR

--

--

N

SQL_INTERVAL_DAY_TO_MINUTE

--

--

N

SQL_INTERVAL_DAY_TO_SECOND

--

--

N

SQL_INTERVAL_HOUR_TO_MINUTE

--

--

N

SQL_INTERVAL_HOUR_TO_SECOND

--

--

N

SQL_INTERVAL_MINUTE_TO_SECOND

--

--

N

Other

SQL_GUID

UUID

Fixed-length GUID

Y

Legend:

--: There is no corresponding data type.

Y: The data type can be used.

N: The data type cannot be used.

#1

If the integer data type format is in legacy format, you cannot use SQL_SMALLINT to access the HADB database. In this case, SQL_SMALLINT can be used as an interface for some of the catalog functions provided by the HADB ODBC driver. For example, SQL_SMALLINT can be used in the value of SQL_DATA_TYPE in the result set column of SQLColumns.

#2

SQL_TYPE_DATE, SQL_TYPE_TIME, and SQL_TYPE_TIMESTAMP are the datetime data types used in ODBC 3.0. Use these data types unless you have a reason not to.

The data types in parentheses are the datetime data types for ODBC 2.0. They are handled in the same way as those for ODBC 3.0. Depending on the value specified for the ADBODBAPMODE environment variable, the identifier in parentheses might be returned in metadata.

#3

If the integer data type format is in legacy format, the corresponding HADB data type is SMALLINT.

#4

If the integer data type format is in legacy format, the corresponding HADB data type is INTEGER.