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.

occiobj.cpp<br />

OCCI Demonstration Programs<br />

The following code example demonstrates how to perform insert, select, update,<br />

and delete operations on a table row containing an object as one of its columns:<br />

/**<br />

* occiobj.cpp - To exhibit the insertion, selection, updating and deletion<br />

* of a row containing object as one of the column.<br />

*<br />

* Description<br />

* Create a program which has insert, select, update & delete as operations<br />

* of a object. Perform all these operations using OCCI interface.<br />

*/<br />

#include <br />

#include <br />

using namespace oracle::occi;<br />

using namespace std;<br />

#include "occiobjm.h"<br />

class occiobj<br />

{<br />

private:<br />

Environment *env;<br />

Connection *con;<br />

Statement *stmt;<br />

public:<br />

occiobj (string user, string passwd, string db)<br />

{<br />

env = Environment::createEnvironment (Environment::OBJECT);<br />

occiobjm (env);<br />

con = env->createConnection (user, passwd, db);<br />

}<br />

~occiobj ()<br />

{<br />

env->terminateConnection (con);<br />

Environment::terminateEnvironment (env);<br />

}<br />

/**<br />

* Insertion of a row<br />

OCCI Demonstration Programs A-43

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

Saved successfully!

Ooh no, something went wrong!