org.apache.cayenne.access.jdbc
Class SQLTemplateAction

java.lang.Object
  extended by org.apache.cayenne.access.jdbc.SQLTemplateAction
All Implemented Interfaces:
SQLAction

public class SQLTemplateAction
extends Object
implements SQLAction

Implements a strategy for execution of SQLTemplates.

Since:
1.2 replaces SQLTemplateExecutionPlan
Author:
Andrus Adamchik

Field Summary
protected  DbAdapter adapter
           
protected  SQLTemplate query
           
 
Constructor Summary
SQLTemplateAction(SQLTemplate query, DbAdapter adapter)
           
 
Method Summary
protected  void bind(PreparedStatement preparedStatement, ParameterBinding[] bindings)
          Binds parameters to the PreparedStatement.
protected  void execute(Connection connection, OperationObserver callback, SQLStatement compiled, Collection updateCounts)
           
protected  String extractTemplateString()
          Extracts a template string from a SQLTemplate query.
 DbAdapter getAdapter()
          Returns DbAdapter associated with this execution plan object.
 SQLTemplate getQuery()
          Returns a SQLTemplate for this action.
 boolean isRemovingLineBreaks()
          Deprecated. since 3.0
 void performAction(Connection connection, OperationObserver callback)
          Runs a SQLTemplate query, collecting all results.
protected  void processSelectResult(SQLStatement compiled, Connection connection, Statement statement, ResultSet resultSet, OperationObserver callback, long startTime)
           
 void setRemovingLineBreaks(boolean removingLineBreaks)
          Deprecated. since 3.0 - does nothing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adapter

protected DbAdapter adapter

query

protected SQLTemplate query
Constructor Detail

SQLTemplateAction

public SQLTemplateAction(SQLTemplate query,
                         DbAdapter adapter)
Method Detail

getAdapter

public DbAdapter getAdapter()
Returns DbAdapter associated with this execution plan object.


performAction

public void performAction(Connection connection,
                          OperationObserver callback)
                   throws SQLException,
                          Exception
Runs a SQLTemplate query, collecting all results. If a callback expects an iterated result, result processing is stopped after the first ResultSet is encountered.

Specified by:
performAction in interface SQLAction
Throws:
SQLException
Exception

execute

protected void execute(Connection connection,
                       OperationObserver callback,
                       SQLStatement compiled,
                       Collection updateCounts)
                throws SQLException,
                       Exception
Throws:
SQLException
Exception

processSelectResult

protected void processSelectResult(SQLStatement compiled,
                                   Connection connection,
                                   Statement statement,
                                   ResultSet resultSet,
                                   OperationObserver callback,
                                   long startTime)
                            throws Exception
Throws:
Exception

extractTemplateString

protected String extractTemplateString()
Extracts a template string from a SQLTemplate query. Exists mainly for the benefit of subclasses that can customize returned template.

Since:
1.2

bind

protected void bind(PreparedStatement preparedStatement,
                    ParameterBinding[] bindings)
             throws SQLException,
                    Exception
Binds parameters to the PreparedStatement.

Throws:
SQLException
Exception

isRemovingLineBreaks

public boolean isRemovingLineBreaks()
Deprecated. since 3.0

Always returns true.


setRemovingLineBreaks

public void setRemovingLineBreaks(boolean removingLineBreaks)
Deprecated. since 3.0 - does nothing


getQuery

public SQLTemplate getQuery()
Returns a SQLTemplate for this action.



Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.