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 />

Example for <strong>C++</strong><br />

The following example is of an OTT command that invokes the OTT utility and<br />

generates <strong>C++</strong> classes:<br />

ott userid=scott/tiger intype=demoin.typ outtype=demoout.typ code=cpp<br />

hfile=demo.h cppfile=demo.cpp mapfile=RegisterMappings.cpp<br />

This command causes the OTT utility to connect to the database as username<br />

scott with password tiger, and use the demoin.typ file as the INTYPE file, and<br />

the demoout.typ file as the OUTTYPE file. The resulting declarations are output to<br />

the file demo.h in <strong>C++</strong>, specified by the CODE=cpp parameter, the method<br />

implementations written to the file demo.cpp, and the functions to register<br />

mappings is written to RegisterMappings.cpp with its prototype written to<br />

RegisterMappings.h.<br />

By using the same demoin.typ file and employee type as in the previous section,<br />

the OTT utility generates the following files:<br />

■ demo.h<br />

■ demo.cpp<br />

Note: Parameters in the INTYPE file control the way generated<br />

structures are named. In this example, the structure name employee<br />

matches the database type name employee. The structure name is<br />

in lowercase because of the line CASE=lower in the INTYPE file.<br />

See Also: "OTT Utility Datatype Mappings" on page 7-16 for<br />

more information about types.<br />

■ RegisterMappings.h<br />

■ RegisterMappings.cpp<br />

■ demoout.typ<br />

The contents of these files are displayed in the following sections:<br />

■ Contents of the demo.h File<br />

■ Contents of the demo.cpp File<br />

■ Contents of the RegisterMappings.h File<br />

■ Contents of the RegisterMappings.cpp File<br />

How to Use the Object Type Translator Utility 7-5

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

Saved successfully!

Ooh no, something went wrong!