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 SourcePro C++ API Reference Guide.
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) 10 <= p < 191 | LongLong | long long |
NUMBER(p,0) p >= 19 | Decimal | RWDecimalPortable |
NUMBER(p,s) 0 < p < 101 | Double | double |
NUMBER(p,s) p >= 10 | Decimal | RWDecimalPortable |
NUMBER | Decimal | RWDecimalPortable |
FLOAT(p) | Double | double |
BINARY_FLOAT | Float | float |
BINARY_DOUBLE | Double | double |
DATE2 | DateTime | RWDBDateTime3 RWDateTime |
ROWID | String | RWCString |
MLSLABEL | String | RWCString |
TIMESTAMP2,4 | DateTime | RWDBDateTime3 RWDateTime |
RWDBValue::ValueType | Oracle Data Type |
Blob | BLOB, if nativeType of the RWDBColumn is SQLT_BLOB RAW(n), using the storageLength of the RWDBColumn for value n, 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 | DATE if useTimestamp() is false1 TIMESTAMP(p), using precision of RWDBColumn, if useTimestamp() is true and precision is specified TIMESTAMP otherwise |
Decimal | NUMBER(p,s), using precision and scale of RWDBColumn if precision is specified NUMBER otherwise |
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 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.
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.
Provide feedback to Rogue Wave about its documentation.