thinkmap.datasource.database
Class ProcedureCallDataSource

java.lang.Object
  extended by thinkmap.datasource.database.QueryDataSource
      extended by thinkmap.datasource.database.ProcedureCallDataSource

public class ProcedureCallDataSource
extends QueryDataSource

A modification of QueryDataSource that supports stored procedures, in particular with Oracle, and in particular out parameters.

Out parameters are arguments, but they do not bind on input. They bind on output. If an out parameter binds to a result set (cursor), that result set can be given a mapping to output an entity (or entities). Each out cursor needs to have a separate set of result mappings. The xml will look like this: <call> <sql>...</sql> <arguments> ... (bindings, including out bindings) </arguments> <results> ... (mappings for result set returned, if any) </results> <outresults> <outresult index="2"> (0-based index of cursor argument) <result> ... (entity result binding) </result> </outresult> <outresults> </call>

Version:
$Revision: 1.4 $

Field Summary
 
Fields inherited from class thinkmap.datasource.database.QueryDataSource
bindableEntityType, bindings, database, debug, entityMappings, maxResults, query, rejectionBinding, requestType
 
Constructor Summary
ProcedureCallDataSource()
           
 
Method Summary
protected  void executeQuery(Message message, SourceEntity entity, EntityId id, IEntityHandler callback, Connection c)
          The main method that is called to execute the entire query.
 OutResult[] getOutResults()
          Get the the array of out parameter results.
protected  void outputResults(EntityResultMapping[] mappings, ResultSet rs, Message message, SourceEntity entity, EntityId id, IEntityHandler callback)
           
 void setOutResults(OutResult[] outResults)
          Set the array of out parameter results.
 
Methods inherited from class thinkmap.datasource.database.QueryDataSource
bindParameters, canBind, getArguments, getBindableEntityType, getRejectionBinding, getRequestType, getResults, getSQL, outputResults, prepareQuery, processRequest, setArguments, setBindableEntityType, setDebug, setMaxResults, setRejectionBinding, setRequestType, setResults, setSQL, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcedureCallDataSource

public ProcedureCallDataSource()
Method Detail

getOutResults

public OutResult[] getOutResults()
Get the the array of out parameter results.

Returns:
out results

setOutResults

public void setOutResults(OutResult[] outResults)
Set the array of out parameter results. These should correspond to out bindings in the procedure arguments.

Parameters:
outResults - out results

executeQuery

protected void executeQuery(Message message,
                            SourceEntity entity,
                            EntityId id,
                            IEntityHandler callback,
                            Connection c)
Description copied from class: QueryDataSource
The main method that is called to execute the entire query. This method retrieves the bind parameters, prepares the sql statement, binds the parameters to the statement, executes the prepared statement, and outputs the result set. If you wish to change just one of these operations, then override the corresponding method for each operation rather than this one. If you wish to change how this works completely, then override this method.

Overrides:
executeQuery in class QueryDataSource
Parameters:
message - the incoming message from the client
entity - the entity that was sent to the server from the client during this request (Related Request for instance). Can be null.
id - id the id that was sent to the server from the client during this request. Can be null.
callback - the EntityHandler that is used to transcribe messages back to the client
c - The JDBC Connection

outputResults

protected void outputResults(EntityResultMapping[] mappings,
                             ResultSet rs,
                             Message message,
                             SourceEntity entity,
                             EntityId id,
                             IEntityHandler callback)
                      throws SQLException,
                             BindingException
Throws:
SQLException
BindingException


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.