13.5 ODBC function data types and HiRDB data types

Table 13-3 shows the correspondence between ODBC function data types and server HiRDB data types.

ODBC function data type refers to an SQL data type that is specified in an argument of an ODBC function.

Table 13-3 ODBC function data types and HiRDB data types

ClassificationODBC data typeHiRDB data typeDescriptionAvailability
Character dataSQL_CHARCHAR(n)Fixed-length character stringU
SQL_VARCHARVARCHAR(n)Variable-length character stringU
SQL_LONGVARCHARVARCHAR(n)Variable-length character stringU
SQL_CHARNCHAR(n)Fixed-length national character string NATIONAL CHARACTER(n)U
SQL_VARCHARNVARCHAR(n)Variable-length national character stringU
SQL_CHARMCHAR(n)Fixed-length mixed character stringU
SQL_VARCHARMVARCHAR(n)Variable-length mixed character stringU
Numeric dataSQL_DECIMALDEC[IMAL](p,s)Fixed-point number
Precision (total number of digits) = p, Scale (number of digits below the decimal point) = s
1 [Figure] p[Figure] 15, 0 [Figure] s[Figure] p
U
SQL_NUMERIC[Figure]NU
SQL_SMALLINTSMALLINTInteger from -32,768 to 32,767U
SQL_INTEGERINTEGERInteger from -2,147,483,648 to 2,147,483,647U
SQL_TINYINT[Figure]Integer from -256 to 255NU
SQL_BIGINT[Figure]1-digit sign and 19-digit integerNU
SQL_REALSMALLFLT,REALSingle-precision floating-point numberU
SQL_FLOATFLOAT, DOUBLE PRECISIONDouble-precision floating-point numberU
SQL_DOUBLEFLOAT, DOUBLE PRECISIONDouble-precision floating-point numberU
SQL_BIT[Figure]BitNU
SQL_BINARY[Figure]Fixed-length binary dataNU
SQL_LONGVARBINARYBINARY(n)Variable-length binary dataU
SQL_LONGVARBINARYBLOBVariable-length binary dataU
Date and time dataSQL_TYPE_DATEDATEDateU
SQL_TYPE_TIMESTAMPTIMESTAMPDate/timeU
SQL_TYPE_TIMETIMETimeU
[Figure]*INTERVAL YEAR TO DAYDate intervalNU
SQL_INTERVAL_HOUR_TO_SECONDINTERVAL HOUR TO SECONDTime intervalU
User-defined type[Figure]Abstract data typeAbstract data typeNU
[Figure]: Data type not available in ODBC.
U: Can be used.
NU: Cannot be used.
* Database data types in the server are reported without change.
Note
For details about the maximum character string lengths and value ranges for the various data types, see the manual HiRDB Version 8 SQL Reference.
Organization of this section
(1) Facilities available to ODBC functions
(2) Setting update and deletion operations that use cursors
(3) Setting driver options

(1) Facilities available to ODBC functions

When a UAP uses ODBC functions to access the HiRDB system in the server, not all HiRDB facilities are available to the UAP. Table 13-4 lists the facilities that can be used by such a UAP.

Table 13-4 Available facilities

FacilityAvailability
Obtaining special column information[Figure]
Obtaining index informationU
Using date and time data typesU1
Using repetition columnsNU3
Using array columns[Figure]
Obtaining table and column headers[Figure]
Asynchronous processingNU
Using the escape character for the LIKE predicateU
Obtaining an updated row countU
Setting the timeout value for logging inNU
Using Japanese data typesU2
Executing definition SQL statementsU
U: Can be used.
NU: Cannot be used.
[Figure]: Not a DBMS function
1 The INTERVAL YEAR TO DAY data type cannot be used.
2 The database data types are reported without change.
3 A repetition column can be accessed if it has a simple structure without repeated ? parameters.
Example
Column C1 of table T1 is a repetition column.

SELECT C1[1],C1[2] FROM T1             A
SELECT C1 FROM T1                      [Figure]
INSERT INTO T1 VALUES(ARRAY[?,?])      A
INSERT INTO T1 VALUES(?)               [Figure]

A: Can be accessed
[Figure]: Cannot be accessed

(2) Setting update and deletion operations that use cursors

The SQLGetCursorName function obtains the user cursor name that was set with the SQLSetCursorName function. If no cursor name has been set, the SQLGetCursorName function cannot obtain a system-defined cursor. Therefore, set an appropriate user cursor name to update or delete an item with a cursor.

(3) Setting driver options

The options that can be set with the SQLSetConnectOption or SQLGetConnectOption function are limited. Table 13-5 shows the options that can be set.

Table 13-5 Options that can be set with the SQLSetConnectOption and SQLGetConnectOption functions

OptionSetting
SQL_ACCESS_MODESQL_MODE_READ_WRITE
SQL_AUTOCOMMITSQL_AUTOCOMMIT_OFF or SQL_AUTOCOMMIT_ON
SQL_LOGIN_TIMEOUT[Figure]
SQL_TRANSLATE_DLL[Figure]
SQL_TRANSLATE_OPTION[Figure]
SQL_TXN_ISOLATION[Figure]
[Figure]: Cannot be set