Hi all,

The patch for this after taking care of handling the map conditions the
following way, is attached:

null Map      --> throw a SQLException
empty Map     --> no-op
non-empty Map --> throw notImplemented.

thanks
Shreyas

Daniel John Debrunner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Shreyas Kaushik wrote:
> 
> 
>>Hi,
>>
>>  I am attaching the patch to fix the Open issue with key *Derby-33*
>>having the description *Connection.setTypeMap throws unimplemented
>>exception with empty map*.
>>
>> This patch takes care of proper handling of the empty map condition.
>>
>> I have also updated JIRA with my comments on 18-Nov-2004.
>>
>>thanks
>>Shreyas
>>
>>
>>------------------------------------------------------------------------
>>
>>Index: java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
>>===================================================================
>>--- java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
> 
> (revision 105806)
> 
>>+++ java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
> 
> (working copy)
> 
>>@@ -109,7 +109,10 @@
>>      * @exception SQLException Feature not implemented for now.
>>       */
>>     public void setTypeMap(java.util.Map map) throws SQLException {
>>-             throw Util.notImplemented();
>>+        if((map != null)) {
>>+             if(!(map.isEmpty()))
>>+                 throw Util.notImplemented();
>>+        }
>>     }
>>
>>      /*
> 
> 
> 
> Thanks for the patch, though I think the fix does not handle null
> correctly. Passing in null should throw an exception, not be silently
> ignored.
> 
> See this message I sent yesterday.
> 
> http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=950
> 
> Also I think this is a partial fix to Derby 33. Derby should be
> consistent in empty map (and null) handling in other JDBC methods that
> take a type Map (ie. getObject in ResultSet and CallableStatement).
> 
> Dan.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFBnitCIv0S4qsbfuQRApHlAJ4zg43NoYl+7PBHZCv7Z4fKcfy0TQCfWtUY
> 2+At27jA5xEDXOd043EPaJM=
> =GsfY
> -----END PGP SIGNATURE-----
> 

Index: java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java        
(revision 106390)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java        
(working copy)
@@ -44,6 +44,7 @@
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.sql.conn.StatementContext;
+import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.impl.jdbc.EmbedConnection;
@@ -120,7 +121,13 @@
      */
        public Object  getObject (int i, java.util.Map map) throws SQLException 
        {
-               throw Util.notImplemented();
+               if( map == null)
+            throw 
Util.generateCsSQLException(SQLState.NULL_MAP_PASSED,map,"map",
+                                              
"java.sql.CallableStatement.getObject");
+        if(!(map.isEmpty()))
+            throw Util.notImplemented();
+        // Map is empty call the normal getObject method.
+        return getObject(i);
        }
 
     /**
@@ -1108,7 +1115,14 @@
        public Object getObject(String parameterName, Map map)
     throws SQLException
        {
-               throw Util.notImplemented();
+               if( map == null)
+            throw 
Util.generateCsSQLException(SQLState.NULL_MAP_PASSED,map,"map",
+                                              
"java.sql.CallableStatement.getObject");
+        if(!(map.isEmpty()))
+            throw Util.notImplemented();
+
+        // Map is empty so call the normal getObject method.
+        return getObject(parameterName);
        }
 
        /**
Index: java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java       
(revision 106390)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java       
(working copy)
@@ -31,6 +31,7 @@
 import org.apache.derby.jdbc.Driver169;
 
 import org.apache.derby.iapi.store.access.XATransactionController;
+import org.apache.derby.iapi.reference.SQLState;
 
 import java.util.Properties;
 
@@ -109,7 +110,12 @@
      * @exception SQLException Feature not implemented for now.
         */
     public void setTypeMap(java.util.Map map) throws SQLException {
-               throw Util.notImplemented();
+
+        if( map == null)
+            throw 
Util.generateCsSQLException(SQLState.NULL_MAP_PASSED,map,"map",
+                                              
"java.sql.Connection.setTypeMap");
+        if(!(map.isEmpty()))
+            throw Util.notImplemented();
     }
 
        /*
Index: java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java        
(revision 106390)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java        
(working copy)
@@ -1434,7 +1434,13 @@
          * @exception SQLException Feature not implemented for now.
      */
     public Object getObject(int columnIndex, java.util.Map map) throws 
SQLException {
-                throw Util.notImplemented();
+        if( map == null)
+            throw 
Util.generateCsSQLException(SQLState.NULL_MAP_PASSED,map,"map",
+                                              "java.sql.ResultSet.getObject");
+        if(!(map.isEmpty()))
+            throw Util.notImplemented();
+        // Map is empty call the normal getObject method.
+        return getObject(columnIndex);
         }
 
     /**
@@ -1600,7 +1606,13 @@
      */
     public Object getObject(String colName, java.util.Map map)
     throws SQLException {
-                throw Util.notImplemented();
+        if( map == null)
+            throw 
Util.generateCsSQLException(SQLState.NULL_MAP_PASSED,map,"map",
+                                              "java.sql.ResultSet.getObject");
+        if(!(map.isEmpty()))
+            throw Util.notImplemented();
+        // Map is empty call the normal getObject method.
+        return getObject(colName);
         }
 
     /**
Index: java/engine/org/apache/derby/iapi/reference/SQLState.java
===================================================================
--- java/engine/org/apache/derby/iapi/reference/SQLState.java   (revision 
106390)
+++ java/engine/org/apache/derby/iapi/reference/SQLState.java   (working copy)
@@ -1362,6 +1362,7 @@
     String MIDDLE_OF_BATCH = "XJ068.S";
     String NO_SETXXX_FOR_EXEC_USING = "XJ069.S";
     String LANG_NUM_PARAMS_INCORRECT = "XJ080.S";
+    String NULL_MAP_PASSED = "XJ081.S";
     String INTERNAL_ERROR = "XJ999.S";
     String CONN_GENERIC = "X0RQB.S";
     String CONN_REMOTE_ERROR = "X0RQC.S";
Index: java/engine/org/apache/derby/loc/messages_en.properties
===================================================================
--- java/engine/org/apache/derby/loc/messages_en.properties     (revision 
106390)
+++ java/engine/org/apache/derby/loc/messages_en.properties     (working copy)
@@ -1073,6 +1073,7 @@
 XJ068.S=Only executeBatch and clearBatch allowed in the middle of a batch.
 XJ069.S=No SetXXX methods allowed in case of Execute Statement Using.
 XJ080.S=Execute Statement Using passed {0} parameters rather than {1}.
+XJ081.S=Invalid value ''{0}'' passed as parameter ''{1}'' to method ''{2}''
 XJ070.S=Negative or zero position argument ''{0}'' passed in a Blob or Clob 
method.
 XJ071.S=Zero or negative length argument ''{0}'' passed in a Blob or Clob 
method.
 XJ072.S=Null pattern or searchStr passed in to a Blob or Clob position method.

Reply via email to