Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access.jdbc
Class SQLTemplateAction

    java.lang.Object
      org.apache.cayenne.access.jdbc.SQLTemplateAction

All Implemented Interfaces:
  SQLAction

    public class SQLTemplateAction

extends java.lang.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`
`protected boolean` | `removingLineBreaks`

Constructor Summary
`SQLTemplateAction(SQLTemplate query, DbAdapter adapter)`

Method Summary
`protected void` | `bind(java.sql.PreparedStatement preparedStatement, ParameterBinding[] bindings)` Binds parameters to the PreparedStatement.
`protected void` | `execute(java.sql.Connection connection, OperationObserver callback, SQLStatement compiled, java.util.Collection updateCounts)`
`protected java.lang.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()` Returns whether line breaks are removed when the query is executed.
`void` | `performAction(java.sql.Connection connection, OperationObserver callback)` Runs a SQLTemplate query, collecting all results.
`protected void` | `processSelectResult(SQLStatement compiled, java.sql.Connection connection, java.sql.Statement statement, java.sql.ResultSet resultSet, OperationObserver callback, long startTime)`
`void` | `setRemovingLineBreaks(boolean removingLineBreaks)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### adapter

    protected DbAdapter adapter

### removingLineBreaks

    protected boolean removingLineBreaks

### 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(java.sql.Connection connection,
                              OperationObserver callback)
                       throws java.sql.SQLException,
                              java.lang.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:
    `java.sql.SQLException`
    `java.lang.Exception`

### execute

    protected void execute(java.sql.Connection connection,
                           OperationObserver callback,
                           SQLStatement compiled,
                           java.util.Collection updateCounts)
                    throws java.sql.SQLException,
                           java.lang.Exception

  Throws:
    `java.sql.SQLException`
    `java.lang.Exception`

### processSelectResult

    protected void processSelectResult(SQLStatement compiled,
                                       java.sql.Connection connection,
                                       java.sql.Statement statement,
                                       java.sql.ResultSet resultSet,
                                       OperationObserver callback,
                                       long startTime)
                                throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### extractTemplateString

    protected java.lang.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(java.sql.PreparedStatement preparedStatement,
                        ParameterBinding[] bindings)
                 throws java.sql.SQLException,
                        java.lang.Exception

  Binds parameters to the PreparedStatement.

  Throws:
    `java.sql.SQLException`
    `java.lang.Exception`

### isRemovingLineBreaks

    public boolean isRemovingLineBreaks()

  Returns whether line breaks are removed when the query is executed. Some databases (like DB2) can't handle multiline queries.

### setRemovingLineBreaks

    public void setRemovingLineBreaks(boolean removingLineBreaks)

### getQuery

    public SQLTemplate getQuery()

  Returns a SQLTemplate for this action.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.