org.apache.ibatis.executor.resultset
Class FastResultSetHandler

java.lang.Object
  extended by org.apache.ibatis.executor.resultset.FastResultSetHandler
All Implemented Interfaces:
ResultSetHandler
Direct Known Subclasses:
NestedResultSetHandler

public class FastResultSetHandler
extends Object
implements ResultSetHandler


Nested Class Summary
protected static class FastResultSetHandler.ResultColumnCache
           
 
Field Summary
protected  BoundSql boundSql
           
protected  Configuration configuration
           
protected  Executor executor
           
protected  MappedStatement mappedStatement
           
protected  ObjectFactory objectFactory
           
protected  ParameterHandler parameterHandler
           
protected  ResultHandler resultHandler
           
protected  RowBounds rowBounds
           
protected  TypeHandlerRegistry typeHandlerRegistry
           
 
Constructor Summary
FastResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql, RowBounds rowBounds)
           
 
Method Summary
protected  boolean applyAutomaticMappings(ResultSet rs, List<String> unmappedColumnNames, MetaObject metaObject, String columnPrefix, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  boolean applyPropertyMappings(ResultSet rs, ResultMap resultMap, List<String> mappedColumnNames, MetaObject metaObject, ResultLoaderMap lazyLoader, String columnPrefix)
           
protected  void cleanUpAfterHandlingResultSet()
           
protected  void closeResultSet(ResultSet rs)
           
protected  List<Object> collapseSingleResultList(List<Object> multipleResults)
           
protected  Object createParameterizedResultObject(ResultSet rs, Class<?> resultType, List<ResultMapping> constructorMappings, List<Class<?>> constructorArgTypes, List<Object> constructorArgs, String columnPrefix, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  Object createPrimitiveResultObject(ResultSet rs, ResultMap resultMap, String columnPrefix, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  Object createResultObject(ResultSet rs, ResultMap resultMap, List<Class<?>> constructorArgTypes, List<Object> constructorArgs, String columnPrefix, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  Object createResultObject(ResultSet rs, ResultMap resultMap, ResultLoaderMap lazyLoader, String columnPrefix, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  Object getDiscriminatorValue(ResultSet rs, Discriminator discriminator, String columnPrefix)
           
protected  Object getNestedQueryConstructorValue(ResultSet rs, ResultMapping constructorMapping, String columnPrefix)
           
protected  Object getNestedQueryMappingValue(ResultSet rs, MetaObject metaResultObject, ResultMapping propertyMapping, ResultLoaderMap lazyLoader, String columnPrefix)
           
protected  ResultSet getNextResultSet(Statement stmt)
           
protected  Object getPropertyMappingValue(ResultSet rs, MetaObject metaResultObject, ResultMapping propertyMapping, ResultLoaderMap lazyLoader, String columnPrefix)
           
protected  Object getRowValue(ResultSet rs, ResultMap resultMap, CacheKey rowKey, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
 void handleOutputParameters(CallableStatement cs)
           
protected  void handleRefCursorOutputParameter(ResultSet rs, ParameterMapping parameterMapping, MetaObject metaParam)
           
protected  void handleResultSet(ResultSet rs, ResultMap resultMap, List<Object> multipleResults, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
 List<Object> handleResultSets(Statement stmt)
           
protected  void handleRowValues(ResultSet rs, ResultMap resultMap, ResultHandler resultHandler, RowBounds rowBounds, FastResultSetHandler.ResultColumnCache resultColumnCache)
           
protected  Object instantiateParameterObject(Class<?> parameterType)
           
protected  ResultLoaderMap instantiateResultLoaderMap()
           
protected  Object prepareCompositeKeyParameter(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix)
           
protected  Object prepareParameterForNestedQuery(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix)
           
protected  Object prepareSimpleKeyParameter(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix)
           
protected static String prependPrefix(String columnName, String prefix)
           
protected static Set<String> prependPrefixes(Set<String> columnNames, String prefix)
           
 ResultMap resolveDiscriminatedResultMap(ResultSet rs, ResultMap resultMap, String columnPrefix)
           
protected  boolean shouldApplyAutomaticMappings(ResultMap resultMap, boolean def)
           
protected  boolean shouldProcessMoreRows(ResultSet rs, ResultContext context, RowBounds rowBounds)
           
protected  void skipRows(ResultSet rs, RowBounds rowBounds)
           
protected  void validateResultMapsCount(ResultSet rs, int resultMapCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executor

protected final Executor executor

configuration

protected final Configuration configuration

mappedStatement

protected final MappedStatement mappedStatement

rowBounds

protected final RowBounds rowBounds

parameterHandler

protected final ParameterHandler parameterHandler

resultHandler

protected final ResultHandler resultHandler

boundSql

protected final BoundSql boundSql

typeHandlerRegistry

protected final TypeHandlerRegistry typeHandlerRegistry

objectFactory

protected final ObjectFactory objectFactory
Constructor Detail

FastResultSetHandler

public FastResultSetHandler(Executor executor,
                            MappedStatement mappedStatement,
                            ParameterHandler parameterHandler,
                            ResultHandler resultHandler,
                            BoundSql boundSql,
                            RowBounds rowBounds)
Method Detail

handleOutputParameters

public void handleOutputParameters(CallableStatement cs)
                            throws SQLException
Specified by:
handleOutputParameters in interface ResultSetHandler
Throws:
SQLException

handleRefCursorOutputParameter

protected void handleRefCursorOutputParameter(ResultSet rs,
                                              ParameterMapping parameterMapping,
                                              MetaObject metaParam)
                                       throws SQLException
Throws:
SQLException

handleResultSets

public List<Object> handleResultSets(Statement stmt)
                              throws SQLException
Specified by:
handleResultSets in interface ResultSetHandler
Throws:
SQLException

closeResultSet

protected void closeResultSet(ResultSet rs)

cleanUpAfterHandlingResultSet

protected void cleanUpAfterHandlingResultSet()

validateResultMapsCount

protected void validateResultMapsCount(ResultSet rs,
                                       int resultMapCount)

handleResultSet

protected void handleResultSet(ResultSet rs,
                               ResultMap resultMap,
                               List<Object> multipleResults,
                               FastResultSetHandler.ResultColumnCache resultColumnCache)
                        throws SQLException
Throws:
SQLException

collapseSingleResultList

protected List<Object> collapseSingleResultList(List<Object> multipleResults)

handleRowValues

protected void handleRowValues(ResultSet rs,
                               ResultMap resultMap,
                               ResultHandler resultHandler,
                               RowBounds rowBounds,
                               FastResultSetHandler.ResultColumnCache resultColumnCache)
                        throws SQLException
Throws:
SQLException

shouldProcessMoreRows

protected boolean shouldProcessMoreRows(ResultSet rs,
                                        ResultContext context,
                                        RowBounds rowBounds)
                                 throws SQLException
Throws:
SQLException

skipRows

protected void skipRows(ResultSet rs,
                        RowBounds rowBounds)
                 throws SQLException
Throws:
SQLException

getNextResultSet

protected ResultSet getNextResultSet(Statement stmt)
                              throws SQLException
Throws:
SQLException

getRowValue

protected Object getRowValue(ResultSet rs,
                             ResultMap resultMap,
                             CacheKey rowKey,
                             FastResultSetHandler.ResultColumnCache resultColumnCache)
                      throws SQLException
Throws:
SQLException

shouldApplyAutomaticMappings

protected boolean shouldApplyAutomaticMappings(ResultMap resultMap,
                                               boolean def)

instantiateResultLoaderMap

protected ResultLoaderMap instantiateResultLoaderMap()

applyPropertyMappings

protected boolean applyPropertyMappings(ResultSet rs,
                                        ResultMap resultMap,
                                        List<String> mappedColumnNames,
                                        MetaObject metaObject,
                                        ResultLoaderMap lazyLoader,
                                        String columnPrefix)
                                 throws SQLException
Throws:
SQLException

getPropertyMappingValue

protected Object getPropertyMappingValue(ResultSet rs,
                                         MetaObject metaResultObject,
                                         ResultMapping propertyMapping,
                                         ResultLoaderMap lazyLoader,
                                         String columnPrefix)
                                  throws SQLException
Throws:
SQLException

applyAutomaticMappings

protected boolean applyAutomaticMappings(ResultSet rs,
                                         List<String> unmappedColumnNames,
                                         MetaObject metaObject,
                                         String columnPrefix,
                                         FastResultSetHandler.ResultColumnCache resultColumnCache)
                                  throws SQLException
Throws:
SQLException

createResultObject

protected Object createResultObject(ResultSet rs,
                                    ResultMap resultMap,
                                    ResultLoaderMap lazyLoader,
                                    String columnPrefix,
                                    FastResultSetHandler.ResultColumnCache resultColumnCache)
                             throws SQLException
Throws:
SQLException

createResultObject

protected Object createResultObject(ResultSet rs,
                                    ResultMap resultMap,
                                    List<Class<?>> constructorArgTypes,
                                    List<Object> constructorArgs,
                                    String columnPrefix,
                                    FastResultSetHandler.ResultColumnCache resultColumnCache)
                             throws SQLException
Throws:
SQLException

createParameterizedResultObject

protected Object createParameterizedResultObject(ResultSet rs,
                                                 Class<?> resultType,
                                                 List<ResultMapping> constructorMappings,
                                                 List<Class<?>> constructorArgTypes,
                                                 List<Object> constructorArgs,
                                                 String columnPrefix,
                                                 FastResultSetHandler.ResultColumnCache resultColumnCache)
                                          throws SQLException
Throws:
SQLException

createPrimitiveResultObject

protected Object createPrimitiveResultObject(ResultSet rs,
                                             ResultMap resultMap,
                                             String columnPrefix,
                                             FastResultSetHandler.ResultColumnCache resultColumnCache)
                                      throws SQLException
Throws:
SQLException

getNestedQueryConstructorValue

protected Object getNestedQueryConstructorValue(ResultSet rs,
                                                ResultMapping constructorMapping,
                                                String columnPrefix)
                                         throws SQLException
Throws:
SQLException

getNestedQueryMappingValue

protected Object getNestedQueryMappingValue(ResultSet rs,
                                            MetaObject metaResultObject,
                                            ResultMapping propertyMapping,
                                            ResultLoaderMap lazyLoader,
                                            String columnPrefix)
                                     throws SQLException
Throws:
SQLException

prepareParameterForNestedQuery

protected Object prepareParameterForNestedQuery(ResultSet rs,
                                                ResultMapping resultMapping,
                                                Class<?> parameterType,
                                                String columnPrefix)
                                         throws SQLException
Throws:
SQLException

prepareSimpleKeyParameter

protected Object prepareSimpleKeyParameter(ResultSet rs,
                                           ResultMapping resultMapping,
                                           Class<?> parameterType,
                                           String columnPrefix)
                                    throws SQLException
Throws:
SQLException

prepareCompositeKeyParameter

protected Object prepareCompositeKeyParameter(ResultSet rs,
                                              ResultMapping resultMapping,
                                              Class<?> parameterType,
                                              String columnPrefix)
                                       throws SQLException
Throws:
SQLException

instantiateParameterObject

protected Object instantiateParameterObject(Class<?> parameterType)

resolveDiscriminatedResultMap

public ResultMap resolveDiscriminatedResultMap(ResultSet rs,
                                               ResultMap resultMap,
                                               String columnPrefix)
                                        throws SQLException
Throws:
SQLException

getDiscriminatorValue

protected Object getDiscriminatorValue(ResultSet rs,
                                       Discriminator discriminator,
                                       String columnPrefix)
                                throws SQLException
Throws:
SQLException

prependPrefixes

protected static Set<String> prependPrefixes(Set<String> columnNames,
                                             String prefix)

prependPrefix

protected static String prependPrefix(String columnName,
                                      String prefix)


Copyright © 2010-2012 MyBatis.org. All Rights Reserved.