Cursors > Handling Abstract Data Type Values Handling Abstract Data Type Values
Since abstract data types (also called user-defined data types) are supported only for ORDBMSs, the corresponding values make sense only when connected to databases that have this capability. Two such RDBMSs are currently supported: Oracle® and Informix® Universal Server, also called Informix9 in the Rogue Wave DB Link documentation.
The following items are described:
Abstract Data Type Descriptor
Descriptor Class
A descriptor is used to describe abstract data types. This descriptor is implemented by the class
IldADTDescriptor.
Such a descriptor can be embedded in an
IldDescriptor instance if the described column or parameter is of a user-defined type, that is, when the function
IldDescriptor::getType returns either
IldObjectType or
IldCollectionType objects.
Categories of User-Defined Data Types
A value of a user-defined data type is always an instance of
IldADTValue, whether a “horizontal” structure (
object for Oracle,
named row or unnamed
row for Informix Universal Server) or a “vertical” structure (
varray or
nested table for Oracle,
list,
set, or
multiset for Informix US).
To differentiate between them, the user-defined data type descriptor can be queried using the function
getType, which returns an
IldADTType value, according to
Table 4.4:
Categories of User-Defined Data Types
This type | Is used for these data types |
IldADTObject | Objects and named rows |
IldADTTable | Nested tables |
IldADTList | Lists, sets, and multisets |
IldADTArray | Varrays |
The type of a user-defined data type descriptor can only be a value from the enumeration
IldADTType declared in the file
ild.h. In other words, an
IldADTDescriptor instance can represent one of the following:
An Oracle
varray if its type is
IldADTArray,
An Oracle
object or an Informix US
named row or unnamed
row if its type is
IldADTObject,
An Oracle
nested table if its type is
IldADTTable, or
An Informix US
list,
set, or
multiset if its type is
IldADTList.
Abstract Data Type Values
Values of an abstract data type are handled using instances of the class
IldADTValue. Such a value keeps a reference to the abstract data type descriptor, which can be accessed by calling the function
IldADTValue::getDescriptor.
Retrieving Values from the Result Set
An
IldADTValue object is returned by the function
IldRequest::getColADTValue. This object becomes the application’s property. This means that the application must delete it once done with it.
Sending Values as Parameters
Once a parameter has been bound to the Rogue Wave DB Link types
IldObjectType or
IldCollectionType using the member function
IldRequest::bindParam, values can be passed using the overloaded function
setParamValue. The first parameter of this function can be deleted immediately after the call because Rogue Wave DB Link copies it.
Accessing Attribute Values
Whether the object represents the value of an object type or the value of a collection type, the individual attribute or slot values are retrieved using the same accessor functions of the form get<type>Value() where <type> can be one of:
String Integer Real Byte Money Date Numeric DateTime Bytes ADT Ref Warning: The values returned for string and ADT types must be copied by the application. |
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.