10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Developing an OCCI Object Application<br />

Pin Object<br />

In most situations, OCCI users do not need to explicitly pin or unpin the objects<br />

because the object cache automatically keeps track of the pin counts of all the<br />

objects in the cache. As explained earlier, the object cache increments the pin count<br />

when a reference points to the object and decrements it when the reference goes out<br />

of scope or no longer points to the object.<br />

But there is one exception. If an OCCI application uses Ref::ptr() method to<br />

get a pointer to the object, then the pin and unpin methods of the PObject class<br />

can be used by the application to control pinning and unpinning of the objects in<br />

the object cache.<br />

Operate on Object in Cache<br />

Note that the object cache does not manage the contents of object copies; it does not<br />

automatically refresh object copies. Your application must ensure the validity and<br />

consistency of object copies.<br />

Flush Changes to Object<br />

Whenever changes are made to object copies in the object cache, your application is<br />

responsible for flushing the changed object to the database.<br />

Memory for the object cache is allocated on demand when objects are loaded into<br />

the object cache.<br />

The client-side object cache is allocated in the program's process space. This object<br />

cache is the memory for objects that have been retrieved from the database server<br />

and are available to your application.<br />

Note: If you initialize the OCCI environment in object mode, your<br />

application allocates memory for the object cache, whether or not<br />

the application actually uses object calls.<br />

There is only one object cache allocated for each OCCI environment. All objects<br />

retrieved or created through different connections within the environment use the<br />

same physical object cache. Each connection has its own logical object cache.<br />

Deletion of an Object<br />

For objects retrieved into the cache by dereferencing a reference, you should not<br />

perform an explicit delete. For such objects, the pin count is incremented when a<br />

Object Programming 3-11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!