Hi,
Attached is the updated patch as per Dan's suggestions.
thanks
Shreyas
Daniel John Debrunner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Shreyas Kaushik wrote:
>
>
>>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
>
>
> Just a couple of minor fixups are needed to the patch.
>
> 1) The SQLState (NULL_MAP_PASSED) needs a more generic name since it's
> intended for any invalid parameter. Eg. INVALID_API_PARAMETER
>
> 2) getObject(String colName, java.util.Map map) should be implemented by
> just calling getObject(findColumnName(columnName, map)). This is
> consistent with the other getXXX(colName) methods and means a single set
> of checks for the map variable.
>
> Can you modify your changes and re-submit the patch.
>
> Thanks,
> Dan.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFBpK/8Iv0S4qsbfuQRAqhuAKDa1QGL7RCcrmOvLdCy3Evq8IK+8QCdHLX6
> 4B6e2XuQbf8mi1urB+KPBy4=
> =/MJ0
> -----END PGP SIGNATURE-----
>
Index: java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
(revision 106542)
+++ 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.INVALID_API_PARAMETER,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.INVALID_API_PARAMETER,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 106542)
+++ 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.INVALID_API_PARAMETER,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 106542)
+++ 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.INVALID_API_PARAMETER,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,7 @@
*/
public Object getObject(String colName, java.util.Map map)
throws SQLException {
- throw Util.notImplemented();
+ return getObject(findColumn(colName),map);
}
/**
Index: java/engine/org/apache/derby/iapi/reference/SQLState.java
===================================================================
--- java/engine/org/apache/derby/iapi/reference/SQLState.java (revision
106542)
+++ 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 INVALID_API_PARAMETER = "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
106542)
+++ 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.