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.

OCCI Demonstration Programs<br />

* The demo sample has starts from startDemo method. This method is called<br />

* by main. startDemo calls other methods, the supporting methods for<br />

* startDemo are,<br />

* insertRows - inserts the rows into the table1<br />

* deleteRows - delete the rows inserted<br />

* insertClob - Inserts a clob and an empty_clob<br />

* populateClob - populates a given clob<br />

* dumpClob - prints the clob as an integer stream<br />

*/<br />

class demoClob<br />

{<br />

private:<br />

string username;<br />

string password;<br />

string url;<br />

void insertRows (Connection *conn)<br />

throw (SQLException)<br />

{<br />

Statement *stmt = conn->createStatement ("INSERT INTO print_media(product_<br />

id,ad_id,ad_composite,ad_sourcetext) VALUES (3333,11001,'10001','SHE')");<br />

stmt->executeUpdate();<br />

stmt->setSQL ("INSERT INTO print_media(product_id,ad_id,ad_composite,ad_<br />

sourcetext) VALUES (4444,11001,'1010','HEM')");<br />

stmt->executeUpdate();<br />

conn->commit();<br />

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

}<br />

void deleteRows (Connection *conn)<br />

throw (SQLException)<br />

{<br />

Statement *stmt = conn->createStatement ("DELETE print_media WHERE product_<br />

id=3333 AND ad_id=11001");<br />

stmt->executeUpdate();<br />

stmt->setSQL("DELETE print_media WHERE product_id=4444 AND ad_id=11001");<br />

stmt->executeUpdate();<br />

conn->commit();<br />

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

}<br />

/**<br />

A-14 <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!