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:
When fetching data or retrieving information about tables, the DB Access Module for Oracle OCI converts the Oracle-specific data type information provided by the database into RWDBValue::ValueTypes. This mapping is shown in Table 1, which also gives the C++ data type corresponding to the RWDBValue::ValueType.
When creating tables, the DB Access Module for Oracle OCI maps the given RWDBValue::ValueType into an Oracle-specific type. This mapping is shown in Table 2.
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 DB Interface Module Reference Guide.
Oracle Data Type | RWDBValue:: ValueType | C++ Data Type |
CHAR(n) | String | |
NCHAR(n) NVARCHAR2(n) | UString | |
LONG | String | |
CLOB | String | |
RAW(n), LONG RAW | Blob | |
BLOB | Blob | |
NUMBER(p,0)1 0<p<10 | Long | long int |
NUMBER(p,0)1 10<=p<19 | LongLong | long long |
NUMBER(p,0) p>=19 | Decimal | |
NUMBER(p,s) p>=10 | Decimal | |
NUMBER(p,s)1 0<p<10 | Double | double |
NUMBER | Decimal | |
FLOAT(p) | Double | double |
BINARY_FLOAT | Float | float |
BINARY_DOUBLE | Double | double |
DATE | DateTime | |
ROWID | String | |
MLSLABEL | String | |
TIMESTAMP3 | DateTime |
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 |
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.
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 |
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.