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.

Example OCCI Application<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 CPerson::writeSQL(oracle::occi::AnyData& streamOCCI_)<br />

{<br />

streamOCCI_.setNumber(ID);<br />

streamOCCI_.setObject(NAME);<br />

streamOCCI_.setRef(CURR_ADDR);<br />

setVector(streamOCCI_, PREV_ADDR_L);<br />

}<br />

Example of <strong>C++</strong> Source File for Object Type STUDENT: cstudent.cpp<br />

#ifndef CSTUDENT_ORACLE<br />

# include "cstudent.h"<br />

#endif<br />

/*****************************************************************/<br />

// generated method implementations for the STUDENT object type.<br />

/*****************************************************************/<br />

OCCI_STD_NAMESPACE::string CStudent::getSchool_name() const<br />

{<br />

return SCHOOL_NAME;<br />

}<br />

void CStudent::setSchool_name(const OCCI_STD_NAMESPACE::string &value)<br />

{<br />

SCHOOL_NAME = value;<br />

}<br />

void *CStudent::operator new(size_t size)<br />

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

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

Saved successfully!

Ooh no, something went wrong!