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.

How to Use the OTT Utility<br />

In this example, the demoin.typ file contains the type to be translated, preceded<br />

by the keyword TYPE. The structure of the OUTTYPE file is similar to the INTYPE<br />

file, with the addition of information obtained by the OTT utility.<br />

Once the OTT utility has completed the translation, the header file contains a C<br />

structure representation of each type specified in the INTYPE file, and a null<br />

indicator structure corresponding to each type.<br />

Let us assume the employee type listed in the INTYPE file is defined as follows:<br />

CREATE TYPE employee AS OBJECT<br />

(<br />

name VARCHAR2(30),<br />

empno NUMBER,<br />

deptno NUMBER,<br />

hiredate DATE,<br />

salary NUMBER<br />

);<br />

The header file, demo.h, generated by the OTT utility includes, among other items,<br />

the following declarations:<br />

struct employee<br />

{<br />

OCIString * name;<br />

OCINumber empno;<br />

OCINumber deptno;<br />

OCIDate hiredate;<br />

OCINumber salary;<br />

};<br />

typedef struct emp_type emp_type;<br />

struct employee_ind<br />

{<br />

OCIInd _atomic;<br />

OCIInd name;<br />

OCIInd empno;<br />

OCIInd deptno;<br />

OCIInd hiredate;<br />

OCIInd salary;<br />

};<br />

typedef struct employee_ind employee_ind;<br />

7-4 <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!