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.

Carrying Forward User Added Code<br />

Code Samples Showing How To Use OTT Markers<br />

Here is an example to demonstrate how OTT markers can be used to solve the<br />

problem introduced by a particular use of GENERATE AS clause.<br />

In this example, because of the use of GENERATE AS clause, FULL_NAME_O was<br />

generated as FullName, which was intended to be an user extended class. Since<br />

FullName is an attribute of PERSON_O class, compiler will flag an error if it does<br />

not find the class declaration for FullName.<br />

With marker support user now can add the header file where needed, or a forward<br />

declaration, or a class declaration and be assured of getting the user added block<br />

carried forward across runs of OTT.<br />

In this example class declaration of FullName is put in mdemo1.h file.<br />

Command line to invoke OTT:<br />

ott case=same userid=scott/tiger code=cpp intype=mdemo1.typ<br />

hfile=mdemo1.h cppfile=mdemo1o.cpp use_marker=true<br />

The build command:<br />

make -f demo_rdbms.mk mdemo1<br />

Following are the files used for this demo program:<br />

■ mdemo1.sql on page 7-68 is the SQLs to create type, tables, and so on<br />

■ mdemo1.typ on page 7-69 is the INTYPE file<br />

■ mdemo1.h on page 7-69 is the OTT generated header file with user addeed code<br />

■ mdemo1o.cpp on page 7-73 is the OTT generated .cpp file with user added<br />

code<br />

■ mdemo1m.cpp on page 7-81 is the OTT generated map file<br />

■ mdemo1m.h on page 7-81 is the OTT generated header file for map file<br />

■ mymdemo1.h on page 7-82 is the user defined header file<br />

■ mdemo1.cpp on page 7-82 is the user defined main program<br />

mdemo1.sql<br />

// -----------------------------------------------------<br />

// mdemo1.sql : SQLs to create type, tables, and so on.<br />

// ---------------------------------------------------connect<br />

scott/tiger;<br />

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