ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbe...@apache.org
Subject svn commit: r822575 - in /ibatis/java/ibatis-3/trunk: ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/ ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/ ibatis-3-core/src/main/java/org/apache/ibatis/binding/ ibatis-3-core/src/...
Date Wed, 07 Oct 2009 03:53:08 GMT
Author: cbegin
Date: Wed Oct  7 03:53:07 2009
New Revision: 822575

URL: http://svn.apache.org/viewvc?rev=822575&view=rev
Log:
Introduced RowLimit parameter instead of loose integers all over the place..  

Modified:
    ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/FlushCacheInterceptor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/SqlMapSessionImpl.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BatchExecutor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/ReuseExecutor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/SimpleExecutor.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/keygen/SelectKeyGenerator.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/RowLimit.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/CallableStatementHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/RoutingStatementHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/SimpleStatementHandler.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java
    ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/FlushCacheInterceptor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/FlushCacheInterceptor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/FlushCacheInterceptor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/builder/FlushCacheInterceptor.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import org.apache.ibatis.cache.Cache;
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.plugin.*;
@@ -10,8 +11,7 @@
 
 @Intercepts({
   @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
-  @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, int.class, int.class,
-      ResultHandler.class})
+  @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowLimit.class, ResultHandler.class})
     })
 public class FlushCacheInterceptor implements Interceptor {
 

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/SqlMapSessionImpl.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/SqlMapSessionImpl.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/SqlMapSessionImpl.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-compat/src/main/java/com/ibatis/sqlmap/engine/impl/SqlMapSessionImpl.java Wed Oct  7 03:53:07 2009
@@ -14,6 +14,7 @@
 import org.apache.ibatis.executor.BatchExecutorException;
 import org.apache.ibatis.executor.BatchResult;
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.result.*;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.mapping.ResultMap;
@@ -116,7 +117,7 @@
       public Object execute(Transaction transaction) throws SQLException {
         MappedStatement ms = configuration.getMappedStatement(id);
         Executor executor = transaction.getExecutor();
-        List list = executor.query(ms, wrapCollection(parameterObject), Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, null);
+        List list = executor.query(ms, wrapCollection(parameterObject), RowLimit.DEFAULT, null);
         if (list.size() == 1) {
           return list.get(0);
         } else if (list.size() > 1) {
@@ -133,13 +134,13 @@
       public Object execute(Transaction transaction) throws SQLException {
         Executor executor = transaction.getExecutor();
         MappedStatement ms = configuration.getMappedStatement(id);
-        return executor.query(ms, wrapCollection(parameterObject), skip, max, null);
+        return executor.query(ms, wrapCollection(parameterObject), new RowLimit(skip, max), null);
       }
     });
   }
 
   public List queryForList(String id, Object parameterObject) throws SQLException {
-    return queryForList(id, parameterObject, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT);
+    return queryForList(id, parameterObject, RowLimit.NO_ROW_OFFSET, RowLimit.NO_ROW_LIMIT);
   }
 
   public List queryForList(String id, int skip, int max) throws SQLException {
@@ -168,7 +169,7 @@
       public Object execute(Transaction transaction) throws SQLException {
         MappedStatement ms = configuration.getMappedStatement(id);
         Executor executor = transaction.getExecutor();
-        return executor.query(ms, wrapCollection(parameterObject), Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, new ResultHandler() {
+        return executor.query(ms, wrapCollection(parameterObject), RowLimit.DEFAULT, new ResultHandler() {
           public void handleResult(ResultContext context) {
             rowHandler.handleRow(context.getResultObject());
           }
@@ -291,7 +292,7 @@
         public Object execute(Transaction transaction) throws SQLException {
           transaction.setCommitRequired(true);
           Executor executor = transaction.getExecutor();
-          return executor.query(keyStatement, parameterObject, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, null);
+          return executor.query(keyStatement, parameterObject, RowLimit.DEFAULT, null);
         }
       });
       try {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.binding;
 
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.session.SqlSession;
 
@@ -95,16 +96,13 @@
     Object result;
     if (hasListBounds) {
       Object param = getParam(args);
-      int offset = Executor.NO_ROW_OFFSET;
-      int limit = Executor.NO_ROW_LIMIT;
+      RowLimit rowLimit = RowLimit.DEFAULT;
       if (args.length == 3) {
-        offset = ((Integer) args[1]);
-        limit = ((Integer) args[2]);
+        rowLimit = new RowLimit((Integer) args[1], (Integer) args[2]);
       } else if (args.length == 2) {
-        offset = ((Integer) args[0]);
-        limit = ((Integer) args[1]);
+        rowLimit = new RowLimit((Integer) args[0], (Integer) args[1]);
       }
-      result = sqlSession.selectList(commandName, param, offset, limit);
+      result = sqlSession.selectList(commandName, param, rowLimit);
     } else {
       Object param = getParam(args);
       result = sqlSession.selectList(commandName, param);

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java Wed Oct  7 03:53:07 2009
@@ -8,6 +8,7 @@
 import org.apache.ibatis.transaction.Transaction;
 import org.apache.ibatis.type.TypeHandlerRegistry;
 import static org.apache.ibatis.executor.ExecutionPlaceholder.*;
+import org.apache.ibatis.executor.resultset.RowLimit;
 
 import java.sql.*;
 import java.util.*;
@@ -64,18 +65,18 @@
     return batchResults;
   }
 
-  public List query(MappedStatement ms, Object parameter, int offset, int limit, ResultHandler resultHandler) throws SQLException {
+  public List query(MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) throws SQLException {
     ErrorContext.instance().resource(ms.getResource()).activity("executing a query").object(ms.getId());
     List list;
     try {
       queryStack++;
-      CacheKey key = createCacheKey(ms, parameter, offset, limit);
+      CacheKey key = createCacheKey(ms, parameter, rowLimit);
       if (localCache.hasKey(key)) {
         list = (List) localCache.getObject(key);
       } else {
         localCache.putObject(key, EXECUTION_PLACEHOLDER);
         try {
-          list = doQuery(ms, parameter, offset, limit, resultHandler);
+          list = doQuery(ms, parameter, rowLimit, resultHandler);
         } finally {
           localCache.removeObject(key);
         }
@@ -96,12 +97,12 @@
     deferredLoads.add(new DeferredLoad(ms, resultObject, property, key));
   }
 
-  public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, int offset, int limit) {
+  public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowLimit rowLimit) {
     BoundSql boundSql = ms.getBoundSql(parameterObject);
     CacheKey cacheKey = new CacheKey();
     cacheKey.update(ms.getId());
-    cacheKey.update(offset);
-    cacheKey.update(limit);
+    cacheKey.update(rowLimit.getOffset());
+    cacheKey.update(rowLimit.getLimit());
     cacheKey.update(boundSql.getSql());
     List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
     if (parameterMappings.size() > 0 && parameterObject != null) {
@@ -153,7 +154,7 @@
   protected abstract List<BatchResult> doFlushStatements()
       throws SQLException;
 
-  protected abstract List doQuery(MappedStatement ms, Object parameter, int offset, int limit, ResultHandler resultHandler)
+  protected abstract List doQuery(MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler)
       throws SQLException;
 
   protected void closeStatement(Statement statement) {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BatchExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BatchExecutor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BatchExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BatchExecutor.java Wed Oct  7 03:53:07 2009
@@ -3,6 +3,7 @@
 import org.apache.ibatis.executor.keygen.*;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.executor.statement.StatementHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.transaction.Transaction;
 
@@ -24,7 +25,7 @@
   public int doUpdate(MappedStatement ms, Object parameterObject)
       throws SQLException {
     Configuration configuration = ms.getConfiguration();
-    StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, null);
+    StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowLimit.DEFAULT, null);
     BoundSql boundSql = handler.getBoundSql();
     String sql = boundSql.getSql();
     Statement stmt;
@@ -43,11 +44,11 @@
     return BATCH_UPDATE_RETURN_VALUE;
   }
 
-  public List doQuery(MappedStatement ms, Object parameterObject, int rowOffset, int rowLimit, ResultHandler resultHandler)
+  public List doQuery(MappedStatement ms, Object parameterObject, RowLimit rowLimit, ResultHandler resultHandler)
       throws SQLException {
     flushStatements();
     Configuration configuration = ms.getConfiguration();
-    StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, rowOffset, rowLimit, resultHandler);
+    StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, rowLimit, resultHandler);
     Connection connection = transaction.getConnection();
     Statement stmt = handler.prepare(connection);
     handler.parameterize(stmt);

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import org.apache.ibatis.cache.*;
 import org.apache.ibatis.executor.result.ResultHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.reflection.MetaObject;
 import org.apache.ibatis.transaction.Transaction;
@@ -36,7 +37,7 @@
   }
 
 
-  public List query(MappedStatement ms, Object parameterObject, int offset, int limit, ResultHandler resultHandler) throws SQLException {
+  public List query(MappedStatement ms, Object parameterObject, RowLimit rowLimit, ResultHandler resultHandler) throws SQLException {
     if (ms != null) {
       Cache cache = ms.getCache();
       if (cache != null) {
@@ -44,23 +45,23 @@
         cache.getReadWriteLock().readLock().lock();
         try {
           if (ms.isUseCache()) {
-            CacheKey key = createCacheKey(ms, parameterObject, offset, limit);
+            CacheKey key = createCacheKey(ms, parameterObject, rowLimit);
             if (cache.hasKey(key)) {
               return (List) cache.getObject(key);
             } else {
-              List list = delegate.query(ms, parameterObject, offset, limit, resultHandler);
+              List list = delegate.query(ms, parameterObject, rowLimit, resultHandler);
               tcm.putObject(cache, key, list);
               return list;
             }
           } else {
-            return delegate.query(ms, parameterObject, offset, limit, resultHandler);
+            return delegate.query(ms, parameterObject, rowLimit, resultHandler);
           }
         } finally {
           cache.getReadWriteLock().readLock().unlock();
         }
       }
     }
-    return delegate.query(ms, parameterObject, offset, limit, resultHandler);
+    return delegate.query(ms, parameterObject, rowLimit, resultHandler);
   }
 
   public List flushStatements() throws SQLException {
@@ -80,8 +81,8 @@
     }
   }
 
-  public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, int offset, int limit) {
-    return delegate.createCacheKey(ms, parameterObject, offset, limit);
+  public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowLimit rowLimit) {
+    return delegate.createCacheKey(ms, parameterObject, rowLimit);
   }
 
   public boolean isCached(MappedStatement ms, CacheKey key) {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import org.apache.ibatis.cache.CacheKey;
 import org.apache.ibatis.executor.result.ResultHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.reflection.MetaObject;
 import org.apache.ibatis.transaction.Transaction;
@@ -11,13 +12,11 @@
 
 public interface Executor {
 
-  int NO_ROW_OFFSET = 0;
-  int NO_ROW_LIMIT = Integer.MAX_VALUE;
   ResultHandler NO_RESULT_HANDLER = null;
 
   int update(MappedStatement ms, Object parameter) throws SQLException;
 
-  List query(MappedStatement ms, Object parameter, int offset, int limit, ResultHandler resultHandler) throws SQLException;
+  List query(MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) throws SQLException;
 
   List<BatchResult> flushStatements() throws SQLException;
 
@@ -25,7 +24,7 @@
 
   void rollback(boolean required) throws SQLException;
 
-  CacheKey createCacheKey(MappedStatement ms, Object parameterObject, int offset, int limit);
+  CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowLimit rowLimit);
 
   boolean isCached(MappedStatement ms, CacheKey key);
 

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/ReuseExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/ReuseExecutor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/ReuseExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/ReuseExecutor.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.executor.statement.StatementHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.transaction.Transaction;
 
@@ -19,14 +20,14 @@
   public int doUpdate(MappedStatement ms, Object parameter)
       throws SQLException {
     Configuration configuration = ms.getConfiguration();
-    StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, null);
+    StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowLimit.DEFAULT, null);
     Statement stmt = prepareStatement(handler);
     return handler.update(stmt);
   }
 
-  public List doQuery(MappedStatement ms, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) throws SQLException {
+  public List doQuery(MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) throws SQLException {
     Configuration configuration = ms.getConfiguration();
-    StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, rowOffset, rowLimit, resultHandler);
+    StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, rowLimit, resultHandler);
     Statement stmt = prepareStatement(handler);
     return handler.query(stmt, resultHandler);
   }

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/SimpleExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/SimpleExecutor.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/SimpleExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/SimpleExecutor.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.executor.statement.StatementHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.transaction.Transaction;
 
@@ -19,7 +20,7 @@
     Statement stmt = null;
     try {
       Configuration configuration = ms.getConfiguration();
-      StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, null);
+      StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowLimit.DEFAULT, null);
       stmt = prepareStatement(handler);
       return handler.update(stmt);
     } finally {
@@ -27,11 +28,11 @@
     }
   }
 
-  public List doQuery(MappedStatement ms, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) throws SQLException {
+  public List doQuery(MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) throws SQLException {
     Statement stmt = null;
     try {
       Configuration configuration = ms.getConfiguration();
-      StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, rowOffset, rowLimit, resultHandler);
+      StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, rowLimit, resultHandler);
       stmt = prepareStatement(handler);
       return handler.query(stmt, resultHandler);
     } finally {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/keygen/SelectKeyGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/keygen/SelectKeyGenerator.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/keygen/SelectKeyGenerator.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/keygen/SelectKeyGenerator.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.keygen;
 
 import org.apache.ibatis.executor.*;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.reflection.MetaObject;
 
@@ -43,7 +44,7 @@
               // Do not close keyExecutor.
               // The transaction will be closed by parent executor.
               Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
-              List values = keyExecutor.query(keyStatement, parameter, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+              List values = keyExecutor.query(keyStatement, parameter, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
               if (values.size() > 1) {
                 throw new ExecutorException("Select statement for SelectKeyGenerator returned more than one value.");
               }

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.loader;
 
 import org.apache.ibatis.executor.*;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.mapping.Configuration;
 import org.apache.ibatis.mapping.Environment;
@@ -63,7 +64,7 @@
       localExecutor = newExecutor();
     }
     try {
-      return localExecutor.query(mappedStatement, parameterObject, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      return localExecutor.query(mappedStatement, parameterObject, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
     } finally {
       if (executor.isClosed()) {
         localExecutor.close();

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java Wed Oct  7 03:53:07 2009
@@ -35,11 +35,11 @@
   private final Map<CacheKey,Set<CacheKey>> localRowValueCaches;
   private final Map<CacheKey,Object> globalRowValueCache;
 
-  public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql, int offset, int limit) {
+  public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql, RowLimit rowLimit) {
     this.executor = executor;
     this.configuration = mappedStatement.getConfiguration();
     this.mappedStatement = mappedStatement;
-    this.rowLimit = new RowLimit(offset, limit);
+    this.rowLimit = rowLimit;
     this.parameterHandler = parameterHandler;
     this.boundSql = boundSql;
     this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
@@ -342,7 +342,7 @@
     final Object nestedQueryParameterObject = prepareParameterForNestedQuery(rs, propertyMapping, nestedQueryParameterType);
     Object value = null;
     if (nestedQueryParameterObject != null) {
-      final CacheKey key = executor.createCacheKey(nestedQuery, nestedQueryParameterObject, RowLimit.NO_ROW_OFFSET, RowLimit.NO_ROW_LIMIT);
+      final CacheKey key = executor.createCacheKey(nestedQuery, nestedQueryParameterObject, RowLimit.DEFAULT);
       if (executor.isCached(nestedQuery, key)) {
         executor.deferLoad(nestedQuery, metaResultObject, property, key);
       } else {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/RowLimit.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/RowLimit.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/RowLimit.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/RowLimit.java Wed Oct  7 03:53:07 2009
@@ -4,6 +4,7 @@
 
   public final static int NO_ROW_OFFSET = 0;
   public final static int NO_ROW_LIMIT = Integer.MAX_VALUE;
+  public final static RowLimit DEFAULT = new RowLimit();
 
   private int offset;
   private int limit;

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java Wed Oct  7 03:53:07 2009
@@ -4,6 +4,7 @@
 import org.apache.ibatis.executor.parameter.ParameterHandler;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.executor.resultset.ResultSetHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.reflection.factory.ObjectFactory;
 import org.apache.ibatis.type.TypeHandlerRegistry;
@@ -20,16 +21,14 @@
 
   protected final Executor executor;
   protected final MappedStatement mappedStatement;
-  protected final int rowOffset;
-  protected final int rowLimit;
+  protected final RowLimit rowLimit;
 
   protected final BoundSql boundSql;
 
-  protected BaseStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, int rowOffset, int rowLimit, ResultHandler resultHandler) {
+  protected BaseStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, RowLimit rowLimit, ResultHandler resultHandler) {
     this.configuration = mappedStatement.getConfiguration();
     this.executor = executor;
     this.mappedStatement = mappedStatement;
-    this.rowOffset = rowOffset;
     this.rowLimit = rowLimit;
 
     this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
@@ -38,7 +37,7 @@
     this.boundSql = mappedStatement.getBoundSql(parameterObject);
 
     this.parameterHandler = configuration.newParameterHandler(mappedStatement, parameterObject, boundSql);
-    this.resultSetHandler = configuration.newResultSetHandler(executor, mappedStatement, rowOffset, rowLimit, parameterHandler, resultHandler, boundSql);
+    this.resultSetHandler = configuration.newResultSetHandler(executor, mappedStatement, rowLimit, parameterHandler, resultHandler, boundSql);
   }
 
   public BoundSql getBoundSql() {

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/CallableStatementHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/CallableStatementHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/CallableStatementHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/CallableStatementHandler.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.statement;
 
 import org.apache.ibatis.executor.*;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.keygen.KeyGenerator;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.*;
@@ -11,8 +12,8 @@
 
 public class CallableStatementHandler extends BaseStatementHandler {
 
-  public CallableStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) {
-    super(executor, mappedStatement, parameter, rowOffset, rowLimit, resultHandler);
+  public CallableStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) {
+    super(executor, mappedStatement, parameter, rowLimit, resultHandler);
   }
 
   public int update(Statement statement)

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.statement;
 
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.keygen.*;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.MappedStatement;
@@ -10,8 +11,8 @@
 
 public class PreparedStatementHandler extends BaseStatementHandler {
 
-  public PreparedStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) {
-    super(executor, mappedStatement, parameter, rowOffset, rowLimit, resultHandler);
+  public PreparedStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) {
+    super(executor, mappedStatement, parameter, rowLimit, resultHandler);
   }
 
   public int update(Statement statement)

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/RoutingStatementHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/RoutingStatementHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/RoutingStatementHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/RoutingStatementHandler.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.statement;
 
 import org.apache.ibatis.executor.*;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.parameter.ParameterHandler;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.*;
@@ -12,17 +13,17 @@
 
   private final StatementHandler delegate;
 
-  public RoutingStatementHandler(Executor executor, MappedStatement ms, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) {
+  public RoutingStatementHandler(Executor executor, MappedStatement ms, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) {
 
     switch (ms.getStatementType()) {
       case STATEMENT:
-        delegate = new SimpleStatementHandler(executor, ms, parameter, rowOffset, rowLimit, resultHandler);
+        delegate = new SimpleStatementHandler(executor, ms, parameter, rowLimit, resultHandler);
         break;
       case PREPARED:
-        delegate = new PreparedStatementHandler(executor, ms, parameter, rowOffset, rowLimit, resultHandler);
+        delegate = new PreparedStatementHandler(executor, ms, parameter, rowLimit, resultHandler);
         break;
       case CALLABLE:
-        delegate = new CallableStatementHandler(executor, ms, parameter, rowOffset, rowLimit, resultHandler);
+        delegate = new CallableStatementHandler(executor, ms, parameter, rowLimit, resultHandler);
         break;
       default:
         throw new ExecutorException("Unknown statement type: " + ms.getStatementType());

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/SimpleStatementHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/SimpleStatementHandler.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/SimpleStatementHandler.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/statement/SimpleStatementHandler.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.executor.statement;
 
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.keygen.*;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.MappedStatement;
@@ -10,8 +11,8 @@
 
 public class SimpleStatementHandler extends BaseStatementHandler {
 
-  public SimpleStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, int rowOffset, int rowLimit, ResultHandler resultHandler) {
-    super(executor, mappedStatement, parameter, rowOffset, rowLimit, resultHandler);
+  public SimpleStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowLimit rowLimit, ResultHandler resultHandler) {
+    super(executor, mappedStatement, parameter, rowLimit, resultHandler);
   }
 
   public int update(Statement statement)

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java Wed Oct  7 03:53:07 2009
@@ -172,14 +172,14 @@
     return parameterHandler;
   }
 
-  public ResultSetHandler newResultSetHandler(Executor executor, MappedStatement mappedStatement, int rowOffset, int rowLimit, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql) {
-    ResultSetHandler resultSetHandler = new DefaultResultSetHandler(executor, mappedStatement, parameterHandler, resultHandler, boundSql, rowOffset, rowLimit);
+  public ResultSetHandler newResultSetHandler(Executor executor, MappedStatement mappedStatement, RowLimit rowLimit, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql) {
+    ResultSetHandler resultSetHandler = new DefaultResultSetHandler(executor, mappedStatement, parameterHandler, resultHandler, boundSql, rowLimit);
     resultSetHandler = (ResultSetHandler) interceptorChain.pluginAll(resultSetHandler);
     return resultSetHandler;
   }
 
-  public StatementHandler newStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, int rowOffset, int rowLimit, ResultHandler resultHandler) {
-    StatementHandler statementHandler = new RoutingStatementHandler(executor, mappedStatement, parameterObject, rowOffset, rowLimit, resultHandler);
+  public StatementHandler newStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, RowLimit rowLimit, ResultHandler resultHandler) {
+    StatementHandler statementHandler = new RoutingStatementHandler(executor, mappedStatement, parameterObject, rowLimit, resultHandler);
     statementHandler = (StatementHandler) interceptorChain.pluginAll(statementHandler);
     return statementHandler;
   }

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java Wed Oct  7 03:53:07 2009
@@ -1,6 +1,7 @@
 package org.apache.ibatis.session;
 
 import org.apache.ibatis.executor.result.ResultHandler;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.mapping.Configuration;
 
 import java.util.List;
@@ -16,11 +17,11 @@
 
   List selectList(String statement, Object parameter);
 
-  List selectList(String statement, Object parameter, int offset, int limit);
+  List selectList(String statement, Object parameter, RowLimit rowLimit);
 
   void select(String statement, Object parameter, ResultHandler handler);
 
-  void select(String statement, Object parameter, int offset, int limit, ResultHandler handler);
+  void select(String statement, Object parameter, RowLimit rowLimit, ResultHandler handler);
 
   int insert(String statement);
 

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java Wed Oct  7 03:53:07 2009
@@ -3,6 +3,7 @@
 import org.apache.ibatis.exceptions.ExceptionFactory;
 import org.apache.ibatis.exceptions.TooManyResultsException;
 import org.apache.ibatis.executor.Executor;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.executor.result.ResultHandler;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.session.*;
@@ -47,26 +48,26 @@
   }
 
   public List selectList(String statement, Object parameter) {
-    return selectList(statement, parameter, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT);
+    return selectList(statement, parameter, RowLimit.DEFAULT);
   }
 
-  public List selectList(String statement, Object parameter, int offset, int limit) {
+  public List selectList(String statement, Object parameter, RowLimit rowLimit) {
     try {
       MappedStatement ms = configuration.getMappedStatement(statement);
-      return executor.query(ms, wrapCollection(parameter), offset, limit, Executor.NO_RESULT_HANDLER);
+      return executor.query(ms, wrapCollection(parameter), rowLimit, Executor.NO_RESULT_HANDLER);
     } catch (Exception e) {
       throw ExceptionFactory.wrapException("Error querying database.  Cause: " + e, e);
     }
   }
 
   public void select(String statement, Object parameter, ResultHandler handler) {
-    select(statement, parameter, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, handler);
+    select(statement, parameter, RowLimit.DEFAULT, handler);
   }
 
-  public void select(String statement, Object parameter, int offset, int limit, ResultHandler handler) {
+  public void select(String statement, Object parameter, RowLimit rowLimit, ResultHandler handler) {
     try {
       MappedStatement ms = configuration.getMappedStatement(statement);
-      executor.query(ms, wrapCollection(parameter), offset, limit, handler);
+      executor.query(ms, wrapCollection(parameter), rowLimit, handler);
     } catch (Exception e) {
       throw ExceptionFactory.wrapException("Error querying database.  Cause: " + e, e);
     }
@@ -86,7 +87,6 @@
 
   public int update(String statement, Object parameter) {
     try {
-      //TODO: Need commitRequired option at the statement level
       dirty = true;
       MappedStatement ms = configuration.getMappedStatement(statement);
       return executor.update(ms, wrapCollection(parameter));

Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java?rev=822575&r1=822574&r2=822575&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java Wed Oct  7 03:53:07 2009
@@ -2,6 +2,7 @@
 
 import domain.blog.*;
 import org.apache.ibatis.BaseDataTest;
+import org.apache.ibatis.executor.resultset.RowLimit;
 import org.apache.ibatis.logging.jdbc.ConnectionLogger;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.transaction.Transaction;
@@ -36,7 +37,7 @@
       MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorMappedStatement(config);
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
       int rows = executor.update(insertStatement, author);
-      List<Author> authors = executor.query(selectStatement, 99, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 99, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, authors.size());
@@ -54,7 +55,7 @@
     try {
       Executor executor = createExecutor(new JdbcTransaction(connection, false));
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectAllAuthorsAutoMappedStatement(config);
-      List<Author> authors = executor.query(selectStatement, null, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, null, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       assertEquals(2, authors.size());
       Author author = authors.get(0);
       // id,username, password, email, bio, favourite_section
@@ -86,7 +87,7 @@
       }
       assertTrue(-1 != author.getId());
       if (author.getId() != BatchExecutor.BATCH_UPDATE_RETURN_VALUE) {
-        List<Author> authors = executor.query(selectStatement, author.getId(), Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+        List<Author> authors = executor.query(selectStatement, author.getId(), RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
         executor.rollback(true);
         assertEquals(1, authors.size());
         assertEquals(author.toString(), authors.get(0).toString());
@@ -108,7 +109,7 @@
       MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorProc(config);
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
       int rows = executor.update(insertStatement, author);
-      List<Author> authors = executor.query(selectStatement, 97, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 97, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, authors.size());
@@ -129,7 +130,7 @@
       MappedStatement insertStatement = ExecutorTestHelper.createInsertAuthorWithIDof99MappedStatement(config);
       MappedStatement selectStatement = ExecutorTestHelper.createSelectAuthorWithIDof99MappedStatement(config);
       int rows = executor.update(insertStatement, null);
-      List<Author> authors = executor.query(selectStatement, 99, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 99, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, authors.size());
@@ -151,7 +152,7 @@
       MappedStatement updateStatement = ExecutorTestHelper.prepareUpdateAuthorMappedStatement(config);
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
       int rows = executor.update(updateStatement, author);
-      List<Author> authors = executor.query(selectStatement, 101, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 101, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, authors.size());
@@ -173,7 +174,7 @@
       MappedStatement deleteStatement = ExecutorTestHelper.prepareDeleteAuthorMappedStatement(config);
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
       int rows = executor.update(deleteStatement, author);
-      List<Author> authors = executor.query(selectStatement, 101, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 101, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(0, authors.size());
@@ -191,7 +192,7 @@
     try {
       Executor executor = createExecutor(new JdbcTransaction(connection, false));
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
-      List<Map> products = executor.query(selectStatement, null, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Map> products = executor.query(selectStatement, null, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       connection.rollback();
       assertEquals(16, products.size());
       for (Map m : products) {
@@ -214,7 +215,7 @@
     try {
       Executor executor = createExecutor(new JdbcTransaction(connection, false));
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
-      List<Map> products = executor.query(selectStatement, null, 4, 10, Executor.NO_RESULT_HANDLER);
+      List<Map> products = executor.query(selectStatement, null, new RowLimit(4, 10), Executor.NO_RESULT_HANDLER);
       connection.rollback();
       assertEquals(10, products.size());
       for (Map m : products) {
@@ -244,7 +245,7 @@
           put("id1", 101);
           put("id2", 102);
         }
-      }, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      }, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       connection.rollback();
       assertEquals(2, authorSets.size());
       for (List authors : authorSets) {
@@ -268,7 +269,7 @@
       Executor executor = createExecutor(new JdbcTransaction(connection, false));
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectAuthorViaOutParams(config);
       Author author = new Author(102, null, null, null, null, null);
-      executor.query(selectStatement, author, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      executor.query(selectStatement, author, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       connection.rollback();
 
       assertEquals("sally", author.getUsername());
@@ -292,7 +293,7 @@
       MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
       config.addMappedStatement(selectBlog);
       config.addMappedStatement(selectPosts);
-      List<Post> posts = executor.query(selectPosts, 1, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Post> posts = executor.query(selectPosts, 1, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       assertEquals(2, posts.size());
       assertNotNull(posts.get(1).getBlog());
@@ -314,7 +315,7 @@
       MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostMappedStatement(config);
       config.addMappedStatement(selectBlog);
       config.addMappedStatement(selectPost);
-      List<Post> posts = executor.query(selectPost, 5, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Post> posts = executor.query(selectPost, 5, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, posts.size());
@@ -336,7 +337,7 @@
       MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostWithBlogByAuthorMappedStatement(config);
       config.addMappedStatement(selectBlog);
       config.addMappedStatement(selectPost);
-      List<Post> posts = executor.query(selectPost, 2, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Post> posts = executor.query(selectPost, 2, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       assertEquals(1, posts.size());
       Post post = posts.get(0);
@@ -361,7 +362,7 @@
       config.addMappedStatement(selectBlog);
       config.addMappedStatement(selectPosts);
       config.setLazyLoadingEnabled(true);
-      List<Blog> blogs = executor.query(selectBlog, 1, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Blog> blogs = executor.query(selectBlog, 1, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       assertEquals(1, blogs.size());
       assertEquals(2, blogs.get(0).getPosts().size());
@@ -381,7 +382,7 @@
     try {
       Executor executor = createExecutor(new JdbcTransaction(connection, false));
       MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatementWithConstructorResults(config);
-      List<Author> authors = executor.query(selectStatement, 102, Executor.NO_ROW_OFFSET, Executor.NO_ROW_LIMIT, Executor.NO_RESULT_HANDLER);
+      List<Author> authors = executor.query(selectStatement, 102, RowLimit.DEFAULT, Executor.NO_RESULT_HANDLER);
       executor.flushStatements();
       executor.rollback(true);
       assertEquals(1, authors.size());



Mime
View raw message