Oracle® C++ Call Interface Programmer's Guide 10g Release 1 (10.1) Part Number B10778-01 |
|
|
View PDF |
The RefAny
class is designed to support a reference to any type. Its primary purpose is to handle generic references and allow conversions of Ref
in the type hierarchy. A RefAny
object can be used as an intermediary between any two types, Ref<
x
>
and Ref<
y
>
, where x
and y
are different types.
Table 10-33 Summary of RefAny Methods
Method | Summary |
---|---|
RefAny() |
Constructor for RefAny class. |
clear() |
Clear the reference. |
getConnection() |
Return the connection this ref was created from. |
getUString() |
Returns UString object at the current position of the RefAny object; globalization enabled. |
isNull() |
Check if the RefAny object is NULL . |
markDelete() |
Mark the object as deleted. |
operator=() |
Assignment operator. |
operator==() |
Check if this RefAny object is equal to a specified RefAny . |
operator!=() |
Check if not equal. |
setObject() |
Set the value of a parameter using an object. |
setUString() |
Set a the given UString in the RefAny object. |
unmarkDelete() |
Unmark the object as deleted. |
A Ref<T>
can always be converted to a RefAny
; there is a method to perform the conversion in the Ref<T>
template. Each Ref<T>
has a constructor and assignment operator that takes a reference to RefAny
.
Syntax | Description |
---|---|
RefAny(); |
Creates a NULL RefAny . |
RefAny( const Connection *sessptr, const OCIRef *ref); |
Creates a RefAny from a session pointer and a reference. |
RefAny( const RefAny& src); |
Creates a RefAny as a copy of another RefAny object. |
Parameter | Description |
---|---|
sessptr |
Session pointer |
ref |
A reference |
src |
The source RefAny object to be assigned |
This method clears the reference.
void clear();
Returns the connection from which this reference was instantiated.
const Connection* getConnection() const;
Returns UString
object at the current position of the RefAny
object; globalization enabled.
UString getUString() const; const UString &str);
Returns TRUE
if the object pointed to by this ref is NULL
else FALSE
.
bool isNull() const;
This method marks the referred object as deleted.
void markDelete();
Assigns the ref or the object to a ref. For the first case, the refs are assigned and for the second case, the ref is constructed from the object and then assigned.
RefAny& operator=( const RefAny& src);
Parameter | Description |
---|---|
src |
The source RefAny object to be assigned. |
Compares this ref
with a RefAny
object and returns TRUE
if both the refs are referring to the same object in the cache, otherwise it returns FALSE
.
bool operator== ( const RefAny &refAnyR) const;
Parameter | Description |
---|---|
refAnyR |
RefAny object to which the comparison is made. |
Compares this ref with the RefAny object and returns TRUE
if both the refs are not referring to the same object in the cache, otherwise it returns FALSE
.
bool operator!= ( const RefAny &refAnyR) const;
Parameter | Description |
---|---|
refAnyR |
RefAny object to which the comparison is made. |
Set the value of a parameter using an object; use the C++.lang equivalent objects for integral values. The OCCI specification specifies a standard mapping from C++ Object
types to SQL types. The given parameter C++ object will be converted to the corresponding SQL type before being sent to the database.
Syntax | Description |
---|---|
void setObject( cosnt PObject *objptr, const string &sqltyp); |
Set the value of a parameter using an object. |
void setObject( PObject* objptr, const USting &sqltyp); |
Set the value of a parameter using an object; globalization enabled. |
Parameter | Description |
---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2,... |
val |
The object containing the input parameter value. |
sqltyp |
The SQL type name of the object to be set; should be in the character set associated with the connection. |
Set a the given UString
in the RefAny
object; globalization enabled.
void setUString( const UString &str);
Parameter | Description |
---|---|
str |
The value. |
This method unmarks the referred object as dirty.
void unmarkDelete();