IBM DB2 Information Integrator
Java API Reference
for Developing Wrappers

com.ibm.db2.wrapper
Class Reply

java.lang.Object
  extended bycom.ibm.db2.wrapper.ParsedQueryFragment
      extended bycom.ibm.db2.wrapper.Reply

public class Reply
extends ParsedQueryFragment

The Reply class represents the portion of a request that the wrapper processes. In addition to the actions of the ParsedQueryFragment class, the Reply class adds methods and data members to initiate the following actions:

Advanced Customization is available with the Reply class by using an execution cost (estimated execution time) for the reply query fragment. The wrapper writer can override the default implementation of the costing methods with ones that more precisely describe the execution model of the source. Overriding the default costing is dependent on the default selectivity estimation for the predicates in the query fragment. Selectivity estimates are obtained by calling the UnfencedGenericServer.getSelectivity method that can also be overloaded by the wrapper writer.

Since:
IBM DB2 Information Integrator Version 8.2

Field Summary
static int ASC
          Constant that indicates the ascending ordering for an order entry.
static int DESC
          Constant that indicates the descending ordering for an order entry.
 
Constructor Summary
Reply(Request request, UnfencedGenericServer server)
          Instantiate a Reply for the specified data source (Server) and Request.
 
Method Summary
 void addHeadExp(RequestExp headExp)
          Add a head expression in the SELECT clause of the query.
 void addOrderEntry(int position, int direction)
          Add an order entry in the ORDER BY clause of the query.
 void addPredicate(RequestExp predicate)
          Add a predicate in the WHERE clause of the query.
 void addQuantifier(Quantifier quantifier)
          Add a quantifier in the FROM clause of the query.
 double cardinality()
          Retrieve the cardinality of the result when running the query fragment that is represented by the reply.
 double firstTupleCost()
          Retrieve the cost that is required to obtain the first result tuple for the query fragment that is represented by the reply.
 java.io.Serializable getExecDesc()
          Retrieve the execution descriptor object.
 int getNumberOfOrderEntries()
          Retrieve the number of order entries.
 int[] getOrderEntry(int position)
          Retrieve the order entry at the specified position in the ORDER by clause.
 int[] getParameterOrder()
          Retrieve a list of parameter handles.
 UnfencedGenericServer getServer()
          Retrieve the data source server that this reply belongs to.
 Reply nextReply()
          Retrieve the next reply in the chain.
 double reExecCost()
          Retrieve the cost needed to rerun the query fragment that is represented by the reply.
 void setDistinct(boolean distinct)
          Set the DISTINCT indicator that is specified in the SELECT DISTINCT statement.
 void setExecDesc(java.io.Serializable execDesc)
          Set the execution descriptor object.
 void setNextReply(Reply nextReply)
          Specify the next reply in the chain.
 double totalCost()
          Retrieve the total execution cost that is needed to run the query fragment that is represented by the reply.
 
Methods inherited from class com.ibm.db2.wrapper.ParsedQueryFragment
getDistinct, getHeadExp, getNickname, getNumberOfHeadExp, getNumberOfPredicates, getNumberOfQuantifiers, getPredicate, getQuantifier, getQuantifierByHandle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASC

public static final int ASC
Constant that indicates the ascending ordering for an order entry.

Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Constant Field Values

DESC

public static final int DESC
Constant that indicates the descending ordering for an order entry.

Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Constant Field Values
Constructor Detail

Reply

public Reply(Request request,
             UnfencedGenericServer server)
Instantiate a Reply for the specified data source (Server) and Request.

Parameters:
request - The Request object for which the Reply is generated. The Request object encapsulates a query fragment that is to be analyzed and processed by the wrapper.
server - The Server object that is processing the Request and generates the Reply.
Since:
IBM DB2 Information Integrator Version 8.2
Method Detail

addHeadExp

public final void addHeadExp(RequestExp headExp)
Add a head expression in the SELECT clause of the query.

Parameters:
headExp - The head expression to be added in the SELECT clause.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
RequestExp

addOrderEntry

public final void addOrderEntry(int position,
                                int direction)
                         throws WrapperException
Add an order entry in the ORDER BY clause of the query. An order entry consists of the head expression position and the direction (ASC or DESC).

Parameters:
position - The position of the head expression in the SELECT clause.
direction - The type of ordering: ASC - ascending order or DESC - descending order.
Throws:
WrapperException - if the direction is not valid.
Since:
IBM DB2 Information Integrator Version 8.2

addPredicate

public final void addPredicate(RequestExp predicate)
Add a predicate in the WHERE clause of the query.

Parameters:
predicate - The predicate expression to be added in the WHERE clause.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
RequestExp

addQuantifier

public final void addQuantifier(Quantifier quantifier)
Add a quantifier in the FROM clause of the query.

Parameters:
quantifier - The quantifier to be added in the FROM clause.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Quantifier

cardinality

public double cardinality()
Retrieve the cardinality of the result when running the query fragment that is represented by the reply.

Returns:
The cardinality.
Since:
IBM DB2 Information Integrator Version 8.2

firstTupleCost

public double firstTupleCost()
Retrieve the cost that is required to obtain the first result tuple for the query fragment that is represented by the reply.

Returns:
The first tuple cost.
Since:
IBM DB2 Information Integrator Version 8.2

getExecDesc

public final java.io.Serializable getExecDesc()
Retrieve the execution descriptor object.

Returns:
The execution descriptor.
Since:
IBM DB2 Information Integrator Version 8.2

getNumberOfOrderEntries

public final int getNumberOfOrderEntries()
Retrieve the number of order entries.

Returns:
The number of order entries.
Since:
IBM DB2 Information Integrator Version 8.2

getOrderEntry

public final int[] getOrderEntry(int position)
                          throws WrapperException
Retrieve the order entry at the specified position in the ORDER by clause. An order entry consists of the head expression position and the direction (ASC or DESC).

Parameters:
position - The position of the order entry in the ORDER BY clause. The first entry is at position 1.
Returns:
An array of two integer values: the position of the head expression in the SELECT clause and the order type, either ASC (ascending) or DESC (descending).
Throws:
WrapperException - if the requested position is not valid
Since:
IBM DB2 Information Integrator Version 8.2

getParameterOrder

public final int[] getParameterOrder()
                              throws WrapperException
Retrieve a list of parameter handles. The order of the list corresponds to the order of the parameter values in the RemoteOperation object. The wrapper calls this method after all the head expressions and all the predicates that can be processed by the wrapper have been added to the Reply object.

Returns:
Array of the parameters handles.
Throws:
WrapperException - if the processing fails.
Since:
IBM DB2 Information Integrator Version 8.2

getServer

public final UnfencedGenericServer getServer()
Retrieve the data source server that this reply belongs to.

Returns:
The data source server of the reply.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
UnfencedGenericServer

nextReply

public final Reply nextReply()
Retrieve the next reply in the chain.

Returns:
The next reply in the chain or null if there are no more replies.
Since:
IBM DB2 Information Integrator Version 8.2

reExecCost

public double reExecCost()
Retrieve the cost needed to rerun the query fragment that is represented by the reply.

Returns:
The re-execution cost.
Since:
IBM DB2 Information Integrator Version 8.2

setDistinct

public final void setDistinct(boolean distinct)
Set the DISTINCT indicator that is specified in the SELECT DISTINCT statement.

Parameters:
distinct - The DISTINCT indicator.
Since:
IBM DB2 Information Integrator Version 8.2

setExecDesc

public final void setExecDesc(java.io.Serializable execDesc)
Set the execution descriptor object.

Parameters:
execDesc - The execution descriptor.
Since:
IBM DB2 Information Integrator Version 8.2

setNextReply

public final void setNextReply(Reply nextReply)
Specify the next reply in the chain. Chain the replies when the wrapper returns more than one reply for a request.

Parameters:
nextReply - The Reply object to be added in the chain.
Since:
IBM DB2 Information Integrator Version 8.2

totalCost

public double totalCost()
Retrieve the total execution cost that is needed to run the query fragment that is represented by the reply.

Returns:
The total cost.
Since:
IBM DB2 Information Integrator Version 8.2

IBM DB2 Information Integrator
Java API Reference
for Developing Wrappers

(C)Copyright IBM Corp. 2002. All rights reserved.

Links on this page are made available for your convenience and may take you to non-IBM sites. IBM does not warrant any sample code provided on these sites.