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.

LOB Classes and Methods<br />

Reading and Writing LOBs<br />

A LOB opened when there is no transaction must be closed before the end of<br />

session. If there are LOBs open at the end of session, then the openness is<br />

discarded and no triggers of extensible indexes are fired.<br />

OCCI provides methods for reading and writing LOBS. For nonstreamed reads and<br />

writes, the following methods are used:<br />

■ Bfile::read()<br />

■ Blob::read() and Blob::write()<br />

■ Clob::read() and Clob::write()<br />

For streamed reads and writes, the following methods are used:<br />

■ Bfile::getStream()<br />

■ Blob::getChunkSize(), Blob::getStream(), and<br />

Blob::writeChunk()<br />

■ Clob::getChunkSize(), Clob::getStream(), and<br />

Clob::writeChunk()<br />

The remainder of this section provides code examples for streamed and unstreamed<br />

reads and writes.<br />

Nonstreamed Read<br />

The following code example demonstrates how to obtain data from an internal LOB<br />

(in this example, a BLOB) that is not null by using a nonstreamed read:<br />

ResultSet *rset=stmt->executeQuery("SELECT ad_composite FROM print_media<br />

WHERE product_id=6666");<br />

while(rset->next())<br />

5-10 <strong>Oracle</strong> <strong>C++</strong> <strong>Call</strong> <strong>Interface</strong> Programmer’s <strong>Guide</strong><br />

Note: The definition of a transaction within which an open LOB<br />

value must be closed is one of the following:<br />

■ Between SET TRANSACTION and COMMIT<br />

■ Between DATA MODIFYING DML or SELECT ... FOR<br />

UPDATE and COMMIT<br />

■ Within an autonomous transaction block

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

Saved successfully!

Ooh no, something went wrong!