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.

using namespace oracle::occi;<br />

using namespace std;<br />

#include "occiinhm.h"<br />

/* Add on your methods in this class*/<br />

class foreign_student_obj : public foreign_student<br />

{<br />

/* New methods can be added here */<br />

};<br />

class occiinh<br />

{<br />

private:<br />

Environment *env;<br />

Connection *con;<br />

// This method will return the Ref<br />

RefAny getRefObj(string sqlString)<br />

{<br />

Statement *stmt = con->createStatement (sqlString);<br />

ResultSet *rs;<br />

try<br />

{<br />

rs = stmt->executeQuery ();<br />

if ( rs->next() )<br />

{<br />

RefAny ref1 = rs->getRef (1);<br />

stmt->closeResultSet (rs);<br />

con->terminateStatement (stmt);<br />

return ref1;<br />

}<br />

}<br />

catch(SQLException ex)<br />

{<br />

cout terminateStatement (stmt);<br />

}<br />

public:<br />

OCCI Demonstration Programs<br />

OCCI Demonstration Programs A-37

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

Saved successfully!

Ooh no, something went wrong!