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.

Carrying Forward User Added Code<br />

void CStudent::writeSQL(void *objectOCCI_, void *ctxOCCI_)<br />

{<br />

CStudent *objOCCI_ = (CStudent *) objectOCCI_;<br />

oracle::occi::AnyData streamOCCI_(ctxOCCI_);<br />

try<br />

{<br />

if (objOCCI_->isNull())<br />

streamOCCI_.setNull();<br />

else<br />

objOCCI_->writeSQL(streamOCCI_);<br />

}<br />

catch (oracle::occi::SQLException& excep)<br />

{<br />

excep.setErrorCtx(ctxOCCI_);<br />

}<br />

return;<br />

}<br />

void CStudent::writeSQL(oracle::occi::AnyData& streamOCCI_)<br />

{<br />

CPerson::writeSQL(streamOCCI_);<br />

streamOCCI_.setString(SCHOOL_NAME);<br />

}<br />

Carrying Forward User Added Code<br />

To extend the functionality of OTT generated code, at times programmers may want<br />

to add code in the OTT generated file. The way OTT can distinguish between OTT<br />

generated code and code added by the user is by looking for some predefined<br />

markers (tags). OTT recognizes OTT_USERCODE_START as the "start of user code<br />

marker", and OTT_USERCODE_END as the "end of user code marker".<br />

For OTT marker support, a user block is defined as<br />

OTT_USERCODE_START + user added code + OTT_USERCODE_END<br />

OTT marker support enables carring forward the user added blocks across multiple<br />

runs of OTT.<br />

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

Note: To use OTT marker support, you must use JDK version 1.3<br />

or higher.

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

Saved successfully!

Ooh no, something went wrong!