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.

Executing SQL DDL and DML Statements<br />

or<br />

ConnectionPool->createProxyConnection(const string &name,<br />

string roles[], int numRoles,<br />

Connection::ProxyType proxyType =<br />

Connection::PROXY_DEFAULT);<br />

The following parameters are used in the previous method example:<br />

■ roles[]: The roles array specifies a list of roles to be activated after the proxy<br />

connection is activated for the client<br />

■ Connection::ProxyType proxyType = Connection::PROXY_<br />

DEFAULT: The enumeration Connection::ProxyType lists constants<br />

representing the various ways of achieving proxy authentication. PROXY_<br />

DEFAULT is used to indicate that name represents a database username and is<br />

the only proxy authentication mode currently supported.<br />

Executing SQL DDL and DML Statements<br />

Creating a Statement Handle<br />

SQL is the industry-wide language for working with relational databases. In OCCI<br />

you execute SQL commands by means of the Statement class.<br />

To create a Statement handle, call the createStatement method of the<br />

Connection object, as shown in the following example:<br />

Statement *stmt = conn->createStatement();<br />

Creating a Statement Handle to Execute SQL Commands<br />

Once you have created a Statement handle, execute SQL commands by calling the<br />

execute, executeUpdate, executeArrayUpdate, or executeQuery methods<br />

on the Statement. These methods are used for the following purposes:<br />

■ execute: To execute all nonspecific statement types<br />

■ executeUpdate: To execute DML and DDL statements<br />

■ executeQuery: To execute a query<br />

2-6 <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!