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.

#endif<br />

Map Registry Function<br />

The OTT Utility and OCCI Applications<br />

Since ATTRACCESS=PRIVATE, the access given to the attributes is private and the<br />

accessor (getxxx) and the mutator (setxxx) methods are generated for each of the<br />

attributes.<br />

One function to register the mappings with the environment is generated by the<br />

OTT utility. The function contains the mappings for all the types translated by the<br />

invocation of the OTT utility. The function name is either specified in the MAPFUNC<br />

parameter or, if that parameter is not specified, derived from MAPFILE parameter.<br />

The only argument to the function is the pointer to Environment.<br />

The function uses the provided Environment to get Map and then registers the<br />

mapping of each translated type.<br />

Given the database type and INTYPE file listed in the previous section, and<br />

specifying MAPFILE=RegisterMappings_3.cpp, the map registering function<br />

generated takes the following form:<br />

#ifndef REGISTERMAPPINGS_3_ORACLE<br />

# include "registermappings_3.h"<br />

#endif<br />

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

{<br />

oracle::occi::Map *mapOCCI_ = envOCCI_->getMap();<br />

mapOCCI_->put("SCOTT.FULL_NAME", FullName::readSQL,<br />

FullName::writeSQL);<br />

mapOCCI_->put("SCOTT.ADDRESS", ADDRESS::readSQL, ADDRESS::writeSQL);<br />

mapOCCI_->put("SCOTT.PERSON", PERSON::readSQL, PERSON::writeSQL);<br />

mapOCCI_->put("SCOTT.STUDENT", STUDENT::readSQL,<br />

STUDENT::writeSQL);<br />

}<br />

How to Use the Object Type Translator Utility 7-49

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

Saved successfully!

Ooh no, something went wrong!