Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.3 Datatypes

Data fetched from a database into a DBTools.h++ application are 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 Oracle8 datatypes are mapped into RWDBValues, and lists the C++ class or datatype appropriate for each Oracle8 datatype. See the Oracle8 Application Developer's Guide for more information on Oracle8 datatypes.

Table 1 -- Type mapping when retrieving data

 
Oracle8 DatatypeRWDBValue::ValueTypeC++ Datatype
CHAR(n)
VARCHAR2(n)

String
RWCString
NCHAR(n)
NVARCHAR2(n)
String1
RWCString2
LONG
String
RWCString
CLOB
String
RWCString
RAW(n), LONG RAW
Blob
RWDBBlob
BLOB
Blob
RWDBBlob
NUMBER(p,0) p<10
Long
long int
NUMBER(p,0) p>=10
Decimal
RWDecimalPortable
NUMBER(p,s) p>=10
Decimal
RWDecimalPortable
NUMBER(p,s) p<10
Double
double
FLOAT(p)
Double
double
DATE
DateTime
RWDBDateTime
ROWID
String
RWCString
MLSLABEL
String
RWCString
1Oracle8 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 Oracle8 table, RWDBValue::ValueType is used to define the table's schema. Table 2 shows how DBTools.h++ maps its datatypes to Oracle8 datatypes when defining a schema.

Table 2 -- Type mapping when creating tables

 
RWDBValue::ValueTypeOracle8 Datatype
Blob
RAW(n), if length is less than or equal to 2000;
otherwise, LONG RAW or BLOB based on nativeType(). See also the RWDBOracle8EnvironmentHandle method ociLocatorForDefaultBlob().
Char, UnsignedChar
NUMBER(d), where d is the number of digits needed to store the maximum value a char can express on the client machine
Date
DATE
DateTime
DATE
Decimal
NUMBER(p,s) using precision and scale of column
Double
FLOAT(126)
Duration
Not supported by Oracle8
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 less than or equal to 4000; otherwise, LONG or CLOB based on nativeType().
See also the RWDBOracle8EnvironmentHandle method ociLocatorForDefaultString().

2.3.1 Restrictions on the Use of Datatypes

Oracle8 OCI and servers place restrictions on the use of certain datatypes. Where possible, DBTools.h++ tries to be flexible about datatypes. However, there are situations where conversions are not possible, and in these cases your application must 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 Oracle8
Float
No restrictions
Int, UnsignedInt
No restrictions
Long, UnsignedLong
No restrictions
MBString, WString
Limited to 4,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.