16.10.2015 Views

Getting Startedwith pureQuery

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

244<br />

<strong>Getting</strong> Started with <strong>pureQuery</strong><br />

call(…)<br />

StoredProcedureResult<br />

getList(…)<br />

getArray(…)<br />

List<br />

RowType[]<br />

Instance of<br />

User-defined interface<br />

Data<br />

getIterator(…)<br />

getQuery (…)<br />

Iterator<br />

ResultType<br />

User-defined method<br />

@Call(sql=“CALL …”)<br />

getResults(…)<br />

ResultSet<br />

getOutputParms()<br />

Object[]<br />

close()<br />

call(…)<br />

CallResultType<br />

Figure 12.1 - The possible return types of methods that run stored procedures<br />

In Figure 12.1, RowType represents the format in which each row of a query result is<br />

returned. There are a number of ways to specify this. ResultType represents the format<br />

that is specified by the parameterized type RES of a<br />

com.ibm.pdq.runtime.handlers.ResultHandler object. CallResultType<br />

represents the format that is specified by the parameterized type CAL of a<br />

com.ibm.pdq.runtime.handlers.CallHandlerWithParameters object.<br />

For more information on <strong>pureQuery</strong> handlers, refer to Chapter 8.<br />

12.2 The StoredProcedureResult interface<br />

Inline and annotated methods are both capable of returning an object of the type<br />

com.ibm.pdq.runtime.StoredProcedureResult. The interface<br />

StoredProcedureResult provides several methods that allow you to retrieve the results<br />

of your stored procedure in a variety of formats.<br />

12.2.1 <strong>Getting</strong> the updated values of OUT and INOUT parameters<br />

One of the methods in StoredProcedureResult is getOutputParms, which you can<br />

use to get the updated values of the OUT and INOUT parameters to your SQL stored<br />

procedure call.<br />

The method getOutputParms returns an object array (Object[]) whose length is the<br />

number of parameters to the SQL stored procedure call. Each item in the array

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

Saved successfully!

Ooh no, something went wrong!