Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Access Module for DB2 CLI User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.3 Data Types

The classes RWDBColumn and RWDBValue have an associated RWDBValue::ValueType that specifies the data type of the database column or field being referenced. Mapping between this data type and the database vendor type runs in both directions:

The RWDBValue::ValueTypes, accessible through the type() method, are uniform across all Access Modules. For a complete explanation of the DB Interface Module data model, see Chapter 7, "The Data Model," in the DB Interface Module User's Guide, and RWDBValue in the SourcePro C++ API Reference Guide.


We update the mapping tables regularly, but Rogue Wave cannot be responsible for changes made by other vendors. For the latest information on mappings between the DB2 SQL data types and the actual DB2 server types used on the database, please consult IBM's DB2 Call Level Interface Guide and Reference.

Table 1: Type mapping when retrieving data

DB2 Data Type DB2 SQL Data Type1 RWDBValue:: ValueType C++ Data Type
CHAR
VARCHAR
LONG VARCHAR
CLOB
SQL_CHAR
SQL_VARCHAR
SQL_LONGVARCHAR
SQL_CLOB
String or UString RWCString or RWBasicUString2
CHAR FOR BIT DATA
VARCHAR FOR BIT DATA
LONGVARCHAR FOR BIT DATA
BLOB
SQL_BINARY
SQL_VARBINARY
SQL_LONGVARBINARY
SQL_BLOB
Blob RWDBBlob
SMALLINT SQL_SMALLINT Short short int
BIGINT SQL_BIGINT LongLong long long
INTEGER SQL_INTEGER Long long int
DOUBLE
FLOAT
SQL_DOUBLE
SQL_FLOAT
Double double
REAL SQL_REAL Float float
DATE SQL_TYPE_DATE Date RWDate
NUMERIC
DECIMAL
SQL_NUMERIC
SQL_DECIMAL
Decimal RWDecimalPortable
TIMESTAMP
TIME3
SQL_TYPE_TIMESTAMP
SQL_TYPE_TIME
DateTime RWDBDateTime4 and RWDateTime
GRAPHIC
VARGRAPHIC
LONGVARGRAPHIC5
SQL_GRAPHIC
SQL_VARGRAPHIC
SQL_LONGVARGRAPHIC
SQL_WCHAR
SQL_WVARCHAR
SQL_WLONGVARCHAR
WString RWWString
DECFLOAT SQL_DECFLOAT Decimal RWDecimalPortable
  1. The current release of the DB Access Module for DB2 CLI does not support the DB2 SQL symbolic data types: BLOB LOCATOR, CLOB LOCATOR, DBCLOB, and DBCLOB LOCATOR.
  2. This mapping is affected by the column type that the result data is bound to. Both datatypes are supported when retrieving string data.
  3. Values of type TIMESTAMP and TIME are affected by the time zone setting on either RWDBDatabase or RWDBConnection while sending and retrieving data. The time zone setting can be set programmatically with the timeZone() method in each of these classes.
  4. RWDBDateTime is deprecated. Please use RWDateTime.
  5. GRAPHIC, VARGRAPHIC, and LONGVARGRAPHIC types are available only when the DB2 database is Unicode enabled.

Table 2: Type mapping when creating tables

RWDBValue:: ValueType DB2 Data Type
Char
UnsignedChar
SMALLINT
String
UString
If 0 < length < 255, VARCHAR using the storageLength of the RWDBColumn
If length > 32700, CLOB using the storageLength of the RWDBColumn,
Else LONG VARCHAR
WString
MBString
Not supported
Blob If 0 < length < 255 VARCHAR FOR BIT DATA using the storageLength of the RWDBColumn
If length > 32700, BLOB using the storageLength of the RWDBColumn
Else LONG VARCHAR FOR BIT DATA
Short
UnsignedShort
SMALLINT
Int
UnsignedInt
INTEGER
Long
UnsignedLong
INTEGER
LongLong
UnsignedLongLong
BIGINT
Float FLOAT
Double DOUBLE
LongDouble Not supported
Decimal DECIMAL using the precision and scale of the RWDBColumn, if supplied
Date DATE
DateTime TIMESTAMP
Duration Not supported


Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.