Package org.apache.openjpa.jdbc.kernel
Class SQLStoreQuery.SQLExecutor
- java.lang.Object
-
- org.apache.openjpa.kernel.AbstractStoreQuery.AbstractExecutor
-
- org.apache.openjpa.jdbc.kernel.SQLStoreQuery.SQLExecutor
-
- All Implemented Interfaces:
StoreQuery.Executor
- Enclosing class:
- SQLStoreQuery
public static class SQLStoreQuery.SQLExecutor extends AbstractStoreQuery.AbstractExecutor
Executes the filter as a SQL query.
-
-
Constructor Summary
Constructors Constructor Description SQLExecutor(SQLStoreQuery q, ClassMetaData candidate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.sql.ResultSet
executeQuery(JDBCStore store, java.sql.Connection conn, java.sql.PreparedStatement stmnt, SQLBuffer buf, java.util.List paramList)
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.ResultObjectProvider
executeQuery(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return the result of executing this query with the given parameter values.protected int
executeUpdate(JDBCStore store, java.sql.Connection conn, java.sql.PreparedStatement stmnt, SQLBuffer buf)
This method is to provide override for non-JDBC or JDBC-like implementation of executing update.java.lang.Number
executeUpdate(StoreQuery q, java.lang.Object[] params)
Updates the objects that result from the execution of the query, retuning the number of objects that were updated.java.lang.String[]
getDataStoreActions(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return a description of the commands that will be sent to the datastore in order to execute the query.int
getOperation(StoreQuery q)
Returns the operation this executor is meant to execute.boolean
isPacking(StoreQuery q)
Return true if this executor packs projections into the result class itself.protected java.sql.PreparedStatement
prepareCall(java.sql.Connection conn, SQLBuffer buf)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing call statement.protected java.sql.PreparedStatement
prepareCall(java.sql.Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing call statement.protected java.sql.PreparedStatement
prepareStatement(java.sql.Connection conn, SQLBuffer buf)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.protected java.sql.PreparedStatement
prepareStatement(java.sql.Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.java.lang.Object[]
toParameterArray(StoreQuery q, java.util.Map userParams)
The given query is parsed to find the parameter tokens of the form?
-
Methods inherited from class org.apache.openjpa.kernel.AbstractStoreQuery.AbstractExecutor
executeDelete, getAccessPathMetaDatas, getAlias, getAscending, getOrderedParameterTypes, getOrderingValue, getParameterTypes, getProjectionAliases, getProjectionTypes, getQueryExpressions, getRange, getResultClass, getResultShape, getUpdates, hasGrouping, isAggregate, isDistinct, validate
-
-
-
-
Constructor Detail
-
SQLExecutor
public SQLExecutor(SQLStoreQuery q, ClassMetaData candidate)
-
-
Method Detail
-
getOperation
public int getOperation(StoreQuery q)
Description copied from interface:StoreQuery.Executor
Returns the operation this executor is meant to execute.- Specified by:
getOperation
in interfaceStoreQuery.Executor
- Overrides:
getOperation
in classAbstractStoreQuery.AbstractExecutor
- See Also:
QueryOperations
-
executeUpdate
public java.lang.Number executeUpdate(StoreQuery q, java.lang.Object[] params)
Description copied from interface:StoreQuery.Executor
Updates the objects that result from the execution of the query, retuning the number of objects that were updated.- Specified by:
executeUpdate
in interfaceStoreQuery.Executor
- Overrides:
executeUpdate
in classAbstractStoreQuery.AbstractExecutor
-
executeQuery
public ResultObjectProvider executeQuery(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Description copied from interface:StoreQuery.Executor
Return the result of executing this query with the given parameter values. If this query is a projection and this executor does not pack results itself, each element of the returned result object provider should be an object array containing the projection values.
-
getDataStoreActions
public java.lang.String[] getDataStoreActions(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Description copied from interface:StoreQuery.Executor
Return a description of the commands that will be sent to the datastore in order to execute the query.- Specified by:
getDataStoreActions
in interfaceStoreQuery.Executor
- Overrides:
getDataStoreActions
in classAbstractStoreQuery.AbstractExecutor
-
isPacking
public boolean isPacking(StoreQuery q)
Description copied from interface:StoreQuery.Executor
Return true if this executor packs projections into the result class itself. Executors for query languages that allow projections without result clauses must return true and perform the result packing themselves.- Specified by:
isPacking
in interfaceStoreQuery.Executor
- Overrides:
isPacking
in classAbstractStoreQuery.AbstractExecutor
-
prepareCall
protected java.sql.PreparedStatement prepareCall(java.sql.Connection conn, SQLBuffer buf) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing call statement.- Throws:
java.sql.SQLException
-
executeUpdate
protected int executeUpdate(JDBCStore store, java.sql.Connection conn, java.sql.PreparedStatement stmnt, SQLBuffer buf) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing update.- Throws:
java.sql.SQLException
-
prepareCall
protected java.sql.PreparedStatement prepareCall(java.sql.Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing call statement.- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection conn, SQLBuffer buf) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
java.sql.SQLException
-
executeQuery
protected java.sql.ResultSet executeQuery(JDBCStore store, java.sql.Connection conn, java.sql.PreparedStatement stmnt, SQLBuffer buf, java.util.List paramList) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.- Throws:
java.sql.SQLException
-
toParameterArray
public java.lang.Object[] toParameterArray(StoreQuery q, java.util.Map userParams)
The given query is parsed to find the parameter tokens of the form?n
which is different than?
tokens in actual SQL parameter tokens. These?n
style tokens are replaced in the query string by?
tokens. During the token parsing, the ordering of the tokens is recorded. The given userParam must contain parameter keys as Integer and the same Integers must appear in the tokens.- Returns:
- array with parameter values ordered in the same way as this receiver's executeXXX() method expects.
-
-