16.10.2015 Views

Getting Startedwith pureQuery

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

254<br />

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

have them execute stored procedures. When the parameters to the method are<br />

java.util.Map and <strong>pureQuery</strong> bean objects, and no<br />

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

specified, <strong>pureQuery</strong> updates the properties of the Map or bean objects that represent OUT<br />

and INOUT parameters to the stored procedure. <strong>pureQuery</strong> can return the results of a<br />

stored procedure call as a com.ibm.pdq.runtime.StoredProcedureResult object,<br />

which contains methods for retrieving the updated values of OUT and INOUT parameters,<br />

as well methods for retrieving the query results in various formats. Both inline methods<br />

and annotated methods can return a StoredProcedureResult object. Additionally,<br />

annotated methods can have most of the return types available to methods with the<br />

@Select annotation, if they only need to return one query result from the stored<br />

procedure. When none of <strong>pureQuery</strong> built-in return types provide what your application<br />

needs, a com.ibm.pdq.runtime.handlers.CallHandlerWithParameters<br />

object can specify the return type.<br />

12.6 Questions<br />

1. How do you execute a stored procedure call in the inline style?<br />

2. How do you declare an annotated method that executes a stored procedure call?<br />

3. When you use certain formats to represent your OUT and INOUT parameters,<br />

<strong>pureQuery</strong> can update the objects with the new values. Which of the following<br />

formats can <strong>pureQuery</strong> update?<br />

A. Properties of java.util.Map objects<br />

B. Scalars<br />

C. Properties of <strong>pureQuery</strong> beans<br />

D. Elements of java.util.List objects<br />

4. Which of the following information do<br />

com.ibm.pdq.runtime.StoredProcedureResult objects provide?<br />

A. How long the stored procedure took to run<br />

B. The updated values of OUT and INOUT parameters in an Object array<br />

(Object[])<br />

C. Query results<br />

D. The names of the tables that were affected by the stored procedure<br />

5. True or false: When you use a<br />

com.ibm.pdq.runtime.StoredProcedureResult object to get the results of<br />

your stored procedure call, you should get the query results before you call the<br />

getOutputParms() method.

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

Saved successfully!

Ooh no, something went wrong!