Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Access Module for Oracle OCI 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. See also RWDBValue in the SourcePro C++ API Reference Guide.

Table 1: Type mapping when retrieving data

Oracle Data Type RWDBValue::ValueType C++ Data Type
CHAR(n)
VARCHAR2(n)
String RWCString
NCHAR(n)
NVARCHAR2(n)
UString RWBasicUString
orRWUString
LONG String RWCString
CLOB String RWCString
RAW(n), LONG RAW Blob RWDBBlob
BLOB Blob RWDBBlob
NUMBER(p,0) 0<p<101 Long long int
NUMBER(p,0)1 10<=p<19 LongLong long long
NUMBER(p,0) p>=19 Decimal RWDecimalPortable
NUMBER(p,s) p>=10 Decimal RWDecimalPortable
NUMBER(p,s)1 0<p<10 Double double
NUMBER Decimal RWDecimalPortable
FLOAT(p) Double double
BINARY_FLOAT Float float
BINARY_DOUBLE Double double
DATE DateTime RWDBDateTime2 RWDateTime
ROWID String RWCString
MLSLABEL String RWCString
TIMESTAMP3 DateTime RWDBDateTimeRWDateTime2
  1. For Stored Procedures, due to lack of precision and scale information, the NUMBER column is mapped to RWDecimalPortable
  2. RWDBDateTime is deprecated. Please use RWDateTime.
  3. The datatypes TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE are not supported.

Table 2: Type mapping when creating tables

RWDBValue::ValueType Oracle Data Type
Blob BLOB, if nativeType of the RWDBColumn is SQLT_BLOB
RAW(n), using the storageLength of the RWDBColumn, if 0 < storageLength <= 2000
LONG RAW, otherwise
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 DATE1 or TIMESTAMP(p), using precision of RWDBColumn, if specified
Decimal NUMBER(p,s) using precision and scale of RWDBColumn
Double FLOAT(126)
Duration Not supported by DB Access Module for Oracle OCI.
Float FLOAT(p) using precision of RWDBColumn, if specified.
FLOAT otherwise
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
LongLong,
UnsignedLongLong
NUMBER(d) where d is the number of digits needed to store the maximum value a long long can express on the client machine
MBString, UString,
WString
NVARCHAR2(n) using the storageLength of the RWDBColumn, if specified
NVARCHAR2(2000) otherwise
Short, UnsignedShort,
Tiny, UnsignedTiny
NUMBER(d), where d is the number of digits needed to store the maximum value a short can express on the client machine
String CLOB, if nativeType of the RWDBColumn is SQLT_CLOB.
VARCHAR2(n), using the storageLength of the RWDBColumn, if 0 < storageLength <= 4000
LONG, otherwise
NoType If nativeType of the RWDBColumn is:
"SQLT_NUM, then NUMBER(p,s), using precision and scale of the RWDBColumn
"SQLT_RDD, then ROWID
"SQLT_BFLOAT or SQLT_IBFLOAT, then BINARY_FLOAT
"SQLT_BDOUBLE or SQLT_IBDOUBLE, then BINARY_DOUBLE
  1. To switch between these types, use the useTimestamp() method of the custom environment handle class, RWDBOCIEnvironmentHandle.

2.3.1 Restrictions on the Use of Data Types

Oracle OCI servers place restrictions on the use of certain data types. Where possible, the DB Interface Module is flexible about data types. However, there are situations where conversions are not possible, and in these cases your application must be aware of the contexts in which certain data types can be used. Table 3 outlines the restrictions associated with each DB Interface Module type.

Table 3: Restrictions on the use of DB Interface Module data types

RWDBValue::ValueType Restrictions
Blob No restrictions
Char, UnsignedChar No restrictions
Date No restrictions
DateTime Oracle's TIMESTAMP datatype can hold fractional seconds with a precision of 0 through 9, but RWDBDateTime1 and RWDateTime are limited to milliseconds.
Decimal No restrictions
Double No restrictions
Duration Not supported by DB Access Module for Oracle OCI
Float No restrictions
Int, UnsignedInt No restrictions
Long, UnsignedLong No restrictions
LongLong,
UnsignedLongLong
No restrictions
MBString, UString,
WString
Limited to 4,000 bytes
LongDouble No restrictions
Short, UnsignedShort No restrictions
String No restrictions
  1. RWDBDateTime is deprecated. Please use RWDateTime.


Previous fileTop of DocumentContentsIndex pageNext 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.
Contact Rogue Wave about documentation or support issues.