You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2005/06/25 07:26:33 UTC

svn commit: r201727 - in /ibatis/trunk/java/mapper/mapper2: doc/release.txt src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java

Author: cbegin
Date: Fri Jun 24 22:26:32 2005
New Revision: 201727

URL: http://svn.apache.org/viewcvs?rev=201727&view=rev
Log:
IBATIS-146
IBATIS-130

Fixed consuming of extra result sets, and added pure TypeHandler support for parameters.

Modified:
    ibatis/trunk/java/mapper/mapper2/doc/release.txt
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java

Modified: ibatis/trunk/java/mapper/mapper2/doc/release.txt
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/doc/release.txt?rev=201727&r1=201726&r2=201727&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/doc/release.txt (original)
+++ ibatis/trunk/java/mapper/mapper2/doc/release.txt Fri Jun 24 22:26:32 2005
@@ -8,8 +8,9 @@
  o Fixed IBATIS-136 groupBy not carried forward to extended result maps
  o Fixed IBATIS-139 discriminator being applied to too many result maps (thanks Sven)
  o Fixed IBATIS-152, 149, 116 null result sets now handled properly by JDBC logging classes (thanks Sven)
- o 
-
+ o Fixed IBATIS-146 consumes additional result sets before retrieving output params (JTDS fix)
+ o Fixed IBATIS-130 parameter maps don't allow for complete TypeHandler implementations
+ 
 ------------------------------
  2.1.0 - May 16, 2004
 ------------------------------

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java?rev=201727&r1=201726&r2=201727&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapParser.java Fri Jun 24 22:26:32 2005
@@ -247,10 +247,16 @@
 
         TypeHandler handler = null;
         if (callback != null) {
-          vars.errorCtx.setMoreInfo("Check the parameter mapping typeHandler attribute '" + callback + "' (must be a TypeHandlerCallback implementation).");
+          vars.errorCtx.setMoreInfo("Check the parameter mapping typeHandler attribute '" + callback + "' (must be a TypeHandler or TypeHandlerCallback implementation).");
           try {
-            TypeHandlerCallback typeHandlerCallback = (TypeHandlerCallback) Resources.classForName(callback).newInstance();
-            handler = new CustomTypeHandler(typeHandlerCallback);
+            Object impl = Resources.classForName(callback).newInstance();
+            if (impl instanceof TypeHandlerCallback) {
+              handler = new CustomTypeHandler((TypeHandlerCallback) impl);
+            } else if (impl instanceof TypeHandler) {
+              handler = (TypeHandler) impl;
+            } else {
+              throw new NestedRuntimeException ("The class '"+callback+"' is not a valid implementation of TypeHandler or TypeHandlerCallback");
+            }
           } catch (Exception e) {
             throw new NestedRuntimeException("Error occurred during custom type handler configuration.  Cause: " + e, e);
           }
@@ -379,7 +385,7 @@
 
         TypeHandler handler = null;
         if (callback != null) {
-          vars.errorCtx.setMoreInfo("Check the result mapping typeHandler attribute '" + callback + "' (must be a TypeHandlerCallback implementation).");
+          vars.errorCtx.setMoreInfo("Check the result mapping typeHandler attribute '" + callback + "' (must be a TypeHandler or TypeHandlerCallback implementation).");
           try {
             Object impl = Resources.classForName(callback).newInstance();
             if (impl instanceof TypeHandlerCallback) {
@@ -387,7 +393,7 @@
             } else if (impl instanceof TypeHandler) {
               handler = (TypeHandler) impl;
             } else {
-              throw new NestedRuntimeException ("The class '' is not a valid implementation of TypeHandler or TypeHandlerCallback");
+              throw new NestedRuntimeException ("The class '"+callback+"' is not a valid implementation of TypeHandler or TypeHandlerCallback");
             }
           } catch (Exception e) {
             throw new NestedRuntimeException("Error occurred during custom type handler configuration.  Cause: " + e, e);

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java?rev=201727&r1=201726&r2=201727&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java Fri Jun 24 22:26:32 2005
@@ -290,6 +290,9 @@
       errorContext.setMoreInfo("Check the results (failed to retrieve results).");
       handleResults(request, rs, skipResults, maxResults, callback);
 
+      // consume additional results
+      while (cs.getMoreResults());
+
       errorContext.setMoreInfo("Check the output parameters (retrieval of output parameters failed).");
       retrieveOutputParameters(cs, mappings, parameters);