Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.3 Datatypes

DBTools.h++ stores data fetched from a database into a DBTools.h++ application in instances of the RWDBValue class. Most applications can ignore RWDBValue, and fetch data directly into C++ variables. For applications that do need to use it, Table 1 shows how DB2 SQL symbolic datatypes are mapped onto RWDBValue types, and lists the C++ class or datatype appropriate for each DB2 SQL symbolic datatype.

Table 1 -- Type mapping when retrieving data

 
DB2 SQL symbolic datatypeRWDBValue:: ValueTypeC++ datatype
SQL_CHAR; SQL_VARCHAR;
SQL_LONGVARCHAR;
SQL_CLOB

String
RWCString
SQL_BINARY;
SQL_VARBINARY;
SQL_LONGVARBINARY;
SQL_BLOB

Blob
RWDBBlob
SQL_SMALLINT
Short
short int
SQL_INTEGER
Long
long int
SQL_DOUBLE
Double
double
SQL_REAL,
SQL_FLOAT

Float
float
SQL_DATE
Date
RWDate
SQL_NUMERIC;
SQL_DECIMAL

Decimal
RWDecimalPortable
SQL_TIMESTAMP
SQL_TIME

DateTime
RWDBDateTime


NOTE: The current release of the DB2 access library does not support the following DB2 SQL data types:

BLOB LOCATOR, CLOB LOCATOR, DBCLOB, DBCLOB LOCATOR, GRAPHIC, LONG VARGRAPHIC and VARGRAPHIC.

When an application uses DBTools.h++ to create a table, RWDBValue::ValueType functions are used to define the table's schema. Table 2 shows how DBTools.h++ maps its datatypes to DB2 SQL symbolic data types when defining a schema.

Table 2 -- Type mapping when creating tables

 
RWDBValue::ValueTypeDB2 SQL symbolic datatype
Char, UnsignedChar
SQL_SMALLINT
String
SQL_VARCHAR if 0 < length <= 4000;
SQL_CLOB if 4000 < length <= 2,147,483,647;
WString, MBString
Not supported
Blob
SQL_BLOB
Short, UnsignedShort
SQL_SMALLINT
Int, UnsignedInt
SQL_INTEGER
Long, UnsignedLong
SQL_INTEGER
Float
SQL_FLOAT
Double
SQL_DOUBLE
Decimal
SQL_DECIMAL
Date
SQL_DATE
DateTime
SQL_TIMESTAMP
Duration
SQL_TIME


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.