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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The OTT Utility and OCCI Applications<br />

The prototype of the register mapping function is written to a corresponding header<br />

file, RegisterMapping.h, and looks like the following:<br />

#ifndef REGISTERMAPPINGS_3_ORACLE<br />

# define REGISTERMAPPINGS_3_ORACLE<br />

#ifndef OCCI_ORACLE<br />

# include <br />

#endif<br />

#ifndef DEMO_3_ORACLE<br />

# include "demo_3.h"<br />

#endif<br />

void RegisterMappings_3(oracle::occi::Environment* envOCCI_);<br />

#endif<br />

Extending OTT <strong>C++</strong> Classes<br />

To enhance the functionality of a class generated by the OTT utility, you can derive<br />

new classes. You can also add methods to a class, but <strong>Oracle</strong> does not recommend<br />

doing so due to an inherent risk.<br />

For an example of deriving a new class from an OTT-generated class, assume you<br />

want to generate the class CAddress from the SQL object type ADDRESS. Assume<br />

also that you want to write a class MyAddress to represent ADDRESS objects. The<br />

MyAddress class can be derived from CAddress.<br />

To perform this, the OTT utility must alter the code it generates:<br />

■ By using the MyAddress class instead of the CAddress class to represent<br />

attributes whose database type is ADDRESS<br />

■ By using the MyAddress class instead of the CAddress class to represent<br />

vector and REF elements whose database type is ADDRESS<br />

7-50 <strong>Oracle</strong> <strong>C++</strong> <strong>Call</strong> <strong>Interface</strong> Programmer’s <strong>Guide</strong><br />

See Also: "Carrying Forward User Added Code" on page 7-62 for<br />

details on how to use OTT markers to retain code you want to add<br />

in OTT generated files.

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

Saved successfully!

Ooh no, something went wrong!