Skip Headers

Oracle® C++ Call Interface Programmer's Guide
10g Release 1 (10.1)

Part Number B10778-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

RefAny Class

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.


RefAny()

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


clear()

This method clears the reference.


Syntax
void clear();


getConnection()

Returns the connection from which this reference was instantiated.


Syntax
const Connection* getConnection() const;


getUString()

Returns UString object at the current position of the RefAny object; globalization enabled.


Syntax
UString getUString() const;
   const UString &str);

isNull()

Returns TRUE if the object pointed to by this ref is NULL else FALSE.


Syntax
bool isNull() const;


markDelete()

This method marks the referred object as deleted.


Syntax
void markDelete();


operator=()

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.


Syntax
RefAny& operator=(
   const RefAny& src);
Parameter Description
src
The source RefAny object to be assigned.


operator==()

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.


Syntax
bool operator== (
   const RefAny &refAnyR) const;
Parameter Description
refAnyR
RefAny object to which the comparison is made.


operator!=()

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.


Syntax
bool operator!= (
   const RefAny &refAnyR) const;
Parameter Description
refAnyR
RefAny object to which the comparison is made.


setObject()

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.


setUString()

Set a the given UString in the RefAny object; globalization enabled.


Syntax
void setUString(
   const UString &str);
Parameter Description
str
The value.


unmarkDelete()

This method unmarks the referred object as dirty.


Syntax
void unmarkDelete();