Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.3 Datatypes

Data fetched from a database into a DBTools.h++ application may be stored internally by DBTools.h++ in instances of the RWDBValue class. Most applications can ignore RWDBValue and fetch data directly into C++ variables. If you do need to use it, Table 1 shows how Oracle datatypes are mapped into RWDBValues, and lists the C++ class or datatype appropriate for each Oracle datatype. See the Oracle Application Developer's Guide for more information on Oracle datatypes.

Table 1 -- Type mapping when retrieving data 

 
Oracle DatatypeRWDBValue::ValueTypeC++ Datatype
BLOB/CLOB
Not supported
Not supported
CHAR(n)
VARCHAR2(n)

String
RWCString
DATE
DateTime
RWDBDateTime
FLOAT(p)
Double
double
LONG
String
RWCString
MLSLABEL
String
RWCString
NCHAR(n)
NVARCHAR2(n)
String1
RWCString2
NUMBER(p,s)
Decimal
RWDecimalPortable
NUMBER(p,129)
Double
double
For machines with a 32-bit long:
NUMBER(p,0) p<10
NUMBER(p,0) p>=10

Long
Decimal

long int
RWDecimalPortable
For machines with a 64-bit long:
NUMBER(p,0) p<19
NUMBER(p,0) p>=19

Long
Decimal

long int
RWDecimalPortable
RAW(n), LONG RAW
Blob
RWDBBlob
ROWID
String
RWCString
1Oracle doesn't differentiate when returning standard and national character strings. See Section 2.9.1 on return types.
2See the previous footnote.

When an application uses DBTools.h++ to create an Oracle table, RWDBValue::ValueType is used to define the table's schema. Table 2 shows how DBTools.h++ maps its datatypes to Oracle datatypes when defining a schema.

Table 2 -- Type mapping when creating tables

 
RWDBValue::ValueTypeOracle datatype
Blob
RAW(n) if length <= 255, otherwise LONG RAW
Char, UnsignedChar
NUMBER(38,0)
Date
DATE
DateTime
DATE
Decimal
NUMBER(p,s) using precision and scale of column
Double
FLOAT(126)
Duration
Not supported by Oracle
Float
FLOAT(p) using precision of column
Int, UnsignedInt
NUMBER(d), where d is the number of digits needed to store the maximum value an int can express on the client machine
Long, UnsignedLong
NUMBER(d), where d is the number of digits needed to store the maximum value a long can express on the client machine
MBString, WString
NVARCHAR2
Short, UnsignedShort
NUMBER(d), where d is the number of digits needed to store the maximum value a short can express on the client machine
String
VARCHAR if length is <= 2000, otherwise LONG

2.3.1 Restrictions on the Use of Datatypes

Oracle OCI and servers place restrictions on the use of certain datatypes. Where possible, DBTools.h++ tries to be flexible about datatypes. However, there are some situations where conversions are not possible, and in these cases your application will need to be aware of the contexts in which certain datatypes can be used Table 3 outlines the restrictions associated with each DBTools.h++ type.

Table 3 -- Restrictions on the use of DBTools.h++ datatypes

 
RWDBValue::ValueTypeRestrictions
Blob
No restrictions.
Char, UnsignedChar
No restrictions.
Date
No restrictions.
DateTime
No restrictions.
Decimal
No restrictions.
Double
No restrictions.
Duration
*Not supported by Oracle
Float
No restrictions.
Int, UnsignedInt
No restrictions.
Long, UnsignedLong
No restrictions.
MBString, WString
Limited to 2,000 bytes
Short, UnsignedShort
No restrictions.
String
No restrictions.


Previous fileTop of DocumentContentsIndexNext file

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