You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2006/04/19 15:47:13 UTC

svn commit: r395245 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ client/org/apache/derby/jdbc/ engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/suites/ testing/or...

Author: rhillegas
Date: Wed Apr 19 06:46:42 2006
New Revision: 395245

URL: http://svn.apache.org/viewcvs?rev=395245&view=rev
Log:
DERBY-940: Narayanan's network client support for JDBC4 Wrapper api.

Added:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java   (with props)
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java   (with props)
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java   (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java   (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java Wed Apr 19 06:46:42 2006
@@ -28,6 +28,9 @@
 import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
+import org.apache.derby.client.am.SqlException;
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.shared.common.reference.SQLState;
 
 
 public class CallableStatement40 extends org.apache.derby.client.am.CallableStatement {       
@@ -175,4 +178,36 @@
         throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
     }
     
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java Wed Apr 19 06:46:42 2006
@@ -152,4 +152,69 @@
      */
     DatabaseMetaData newNetDatabaseMetaData(Agent netAgent,
             org.apache.derby.client.am.Connection netConnection);
+    
+    /**
+     * This method provides an instance of Statement or Statement40 
+     * depending on the jdk version under use
+     * @param  agent      Agent
+     * @param  connection Connection
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     Statement newStatement(Agent agent, 
+             org.apache.derby.client.am.Connection connection) 
+             throws SqlException;
+     
+     /**
+     * This method provides an instance of Statement or Statement40 
+     * depending on the jdk version under use
+     * @param  agent            Agent
+     * @param  connection       Connection
+     * @param  type             int
+     * @param  concurrency      int
+     * @param  holdability      int
+     * @param autoGeneratedKeys int
+     * @param columnNames       String[]
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     Statement newStatement(Agent agent, 
+                     org.apache.derby.client.am.Connection connection, int type, 
+                     int concurrency, int holdability,
+                     int autoGeneratedKeys, String[] columnNames) 
+                     throws SqlException;
+     
+    /**
+     * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
+     * on the jdk version under use
+     *
+     * @param logWriter LogWriter
+     * @return a ColumnMetaData implementation
+     *
+     */
+    ColumnMetaData newColumnMetaData(LogWriter logWriter); 
+
+    /**
+     * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
+     * on the jdk version under use
+     *
+     * @param logWriter  LogWriter
+     * @param upperBound int
+     * @return a ColumnMetaData implementation
+     *
+     */
+    ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound);
+    
+    /**
+     * 
+     * returns an instance of ParameterMetaData or ParameterMetaData40 depending 
+     * on the jdk version under use
+     *
+     * @param columnMetaData ColumnMetaData
+     * @return a ParameterMetaData implementation
+     *
+     */
+    ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData);
 }

Added: db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java?rev=395245&view=auto
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java (added)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java Wed Apr 19 06:46:42 2006
@@ -0,0 +1,76 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.ColumnMetaData40
+
+   Copyright (c) 2006 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
+
+public class ColumnMetaData40 extends ColumnMetaData {
+    /**
+     * Calls the superclass constructor to pass the parameters
+     * @param logWriter LogWriter
+     */
+    public ColumnMetaData40(LogWriter logWriter) {
+        super(logWriter);
+    }
+
+    /**
+     * Calls the superclass constructor to pass the parameters
+     * @param logWriter  LogWriter
+     * @param upperBound int
+     */
+    public ColumnMetaData40(LogWriter logWriter, int upperBound) {
+        super(logWriter,upperBound);
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
+}

Propchange: db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java?rev=395245&view=auto
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java (added)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java Wed Apr 19 06:46:42 2006
@@ -0,0 +1,70 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.ParameterMetaData40
+
+   Copyright (c) 2006 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
+
+public class ParameterMetaData40 extends ParameterMetaData {
+    
+    /**
+     *
+     * Calls the superclass constructor to pass the arguments
+     * @param columnMetaData ColumnMetaData
+     *
+     */
+    public ParameterMetaData40(ColumnMetaData columnMetaData) {
+        super(columnMetaData);
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
+}

Propchange: db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Wed Apr 19 06:46:42 2006
@@ -25,6 +25,7 @@
 import java.io.InputStream;
 import java.io.Reader;
 import java.sql.SQLException;
+import org.apache.derby.jdbc.ClientDriver;
 
 public class PreparedStatement extends Statement
         implements java.sql.PreparedStatement,
@@ -1316,9 +1317,10 @@
 
     private ParameterMetaData getParameterMetaDataX() throws SqlException {
         super.checkForClosedStatement();
-        ParameterMetaData pm = new ParameterMetaData(parameterMetaData_ != null
+        ParameterMetaData pm = ClientDriver.getFactory().newParameterMetaData
+                (parameterMetaData_ != null
                 ? parameterMetaData_
-                : new ColumnMetaData(agent_.logWriter_, 0));
+                : ClientDriver.getFactory().newColumnMetaData(agent_.logWriter_, 0));
         if (escapedProcedureCallWithResult_) {
             pm.escapedProcedureCallWithResult_ = true;
         }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java Wed Apr 19 06:46:42 2006
@@ -26,6 +26,9 @@
 import java.sql.SQLXML;
 import java.io.Reader;
 import java.io.InputStream;
+import org.apache.derby.client.am.SqlException;
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class  PreparedStatement40 extends  org.apache.derby.client.am.PreparedStatement{
     
@@ -74,5 +77,37 @@
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) 
                 throws SQLException{
         throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
-    }    
+    }
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
 }

Added: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java?rev=395245&view=auto
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java (added)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java Wed Apr 19 06:46:42 2006
@@ -0,0 +1,94 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.Statement40
+
+   Copyright (c) 2006 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
+
+/**
+ * Implements JDBC 4.0 specific methods
+ */
+
+public class Statement40 extends Statement{
+    /**
+     * Calls the super class constructor to pass the parameters
+     * @param  agent      Agent
+     * @param  connection Connection
+     * @throws SqlException
+     *
+     */
+    public Statement40(Agent agent, Connection connection) throws SqlException {
+        super(agent,connection);
+    }
+    
+    /**
+     * Calls the superclass constructor to pass the arguments
+     * @param agent             Agent
+     * @param connection        Connection
+     * @param type              int
+     * @param concurrency       int
+     * @param holdability       int
+     * @param autoGeneratedKeys int
+     * @param columnNames       String[]
+     * @throws SqlException
+     *
+     */
+    public Statement40(Agent agent, Connection connection, int type, 
+                     int concurrency, int holdability,
+                     int autoGeneratedKeys, String[] columnNames) 
+                     throws SqlException {
+        super(agent,connection,type,concurrency,holdability,autoGeneratedKeys,
+                columnNames);
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
+}

Propchange: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java Wed Apr 19 06:46:42 2006
@@ -26,13 +26,16 @@
 import org.apache.derby.client.ClientPooledConnection;
 import org.apache.derby.client.am.CallableStatement;
 import org.apache.derby.client.am.ClientJDBCObjectFactory;
+import org.apache.derby.client.am.ParameterMetaData;
 import org.apache.derby.client.am.PreparedStatement;
 import org.apache.derby.client.am.Configuration;
 import org.apache.derby.client.am.LogWriter;
 import org.apache.derby.client.am.Agent;
 import org.apache.derby.client.am.Section;
+import org.apache.derby.client.am.Statement;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.Cursor;
+import org.apache.derby.client.am.ColumnMetaData;
 import org.apache.derby.jdbc.ClientDataSource;
 
 /**
@@ -166,5 +169,76 @@
             org.apache.derby.client.am.Connection netConnection) {
         return new NetDatabaseMetaData((NetAgent)netAgent,
                 (NetConnection)netConnection);
+    }
+    
+    /**
+     * This method provides an instance of Statement 
+     * @param  agent      Agent
+     * @param  connection Connection
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     public Statement newStatement(Agent agent, org.apache.derby.client.am.Connection connection) 
+                                            throws SqlException {
+         return new Statement(agent,connection);
+     }
+     
+     /**
+     * This method provides an instance of Statement 
+     * @param  agent            Agent
+     * @param  connection       Connection
+     * @param  type             int
+     * @param  concurrency      int
+     * @param  holdability      int
+     * @param autoGeneratedKeys int
+     * @param columnNames       String[]
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     public Statement newStatement(Agent agent, 
+                     org.apache.derby.client.am.Connection connection, int type, 
+                     int concurrency, int holdability,
+                     int autoGeneratedKeys, String[] columnNames) 
+                     throws SqlException {
+         return new Statement(agent,connection,type,concurrency,holdability,
+                 autoGeneratedKeys,columnNames);
+     }
+     
+     /**
+     * Returns an instanceof ColumnMetaData 
+     *
+     * @param logWriter LogWriter
+     * @return a ColumnMetaData implementation
+     *
+     */
+    public ColumnMetaData newColumnMetaData(LogWriter logWriter) {
+        return new ColumnMetaData(logWriter);
+    }
+
+    /**
+     * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
+     * on the jdk version under use
+     *
+     * @param logWriter  LogWriter
+     * @param upperBound int
+     * @return a ColumnMetaData implementation
+     *
+     */
+    public ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound) {
+        return new ColumnMetaData(logWriter,upperBound);
+    }
+    
+    /**
+     * 
+     * returns an instance of ParameterMetaData 
+     *
+     * @param columnMetaData ColumnMetaData
+     * @return a ParameterMetaData implementation
+     *
+     */
+    public ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData) {
+        return new ParameterMetaData(columnMetaData);
     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java Wed Apr 19 06:46:42 2006
@@ -24,13 +24,19 @@
 import org.apache.derby.client.ClientPooledConnection40;
 import org.apache.derby.client.am.CallableStatement;
 import org.apache.derby.client.am.CallableStatement40;
+import org.apache.derby.client.am.ColumnMetaData;
+import org.apache.derby.client.am.ColumnMetaData40;
 import org.apache.derby.client.am.ClientJDBCObjectFactory;
 import org.apache.derby.client.am.PreparedStatement;
 import org.apache.derby.client.am.PreparedStatement40;
+import org.apache.derby.client.am.ParameterMetaData;
+import org.apache.derby.client.am.ParameterMetaData40;
 import org.apache.derby.client.am.LogWriter;
 import org.apache.derby.client.am.Agent;
 import org.apache.derby.client.am.SQLExceptionFactory40;
 import org.apache.derby.client.am.Section;
+import org.apache.derby.client.am.Statement;
+import org.apache.derby.client.am.Statement40;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.Cursor;
 import org.apache.derby.jdbc.ClientDataSource;
@@ -173,5 +179,76 @@
             org.apache.derby.client.am.Connection netConnection) {
         return new NetDatabaseMetaData40((NetAgent)netAgent,
                 (NetConnection)netConnection);
+    }
+    
+     /**
+     * This method provides an instance of Statement40 
+     * @param  agent      Agent
+     * @param  connection Connection
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     public Statement newStatement(Agent agent, org.apache.derby.client.am.Connection connection) 
+                                            throws SqlException {
+         return new Statement40(agent,connection);
+     }
+     
+     /**
+     * This method provides an instance of Statement40 
+     * @param  agent            Agent
+     * @param  connection       Connection
+     * @param  type             int
+     * @param  concurrency      int
+     * @param  holdability      int
+     * @param autoGeneratedKeys int
+     * @param columnNames       String[]
+     * @return a java.sql.Statement implementation 
+     * @throws SqlException
+     *
+     */
+     public Statement newStatement(Agent agent, 
+                     org.apache.derby.client.am.Connection connection, int type, 
+                     int concurrency, int holdability,
+                     int autoGeneratedKeys, String[] columnNames) 
+                     throws SqlException {
+         return new Statement40(agent,connection,type,concurrency,holdability,
+                 autoGeneratedKeys,columnNames);
+     }
+     
+     /**
+     * Returns an instanceof ColumnMetaData 
+     *
+     * @param logWriter LogWriter
+     * @return a ColumnMetaData implementation
+     *
+     */
+    public ColumnMetaData newColumnMetaData(LogWriter logWriter) {
+        return new ColumnMetaData40(logWriter);
+    }
+
+    /**
+     * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
+     * on the jdk version under use
+     *
+     * @param logWriter  LogWriter
+     * @param upperBound int
+     * @return a ColumnMetaData implementation
+     *
+     */
+    public ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound) {
+        return new ColumnMetaData40(logWriter,upperBound);
+    }
+    
+    /**
+     * 
+     * returns an instance of ParameterMetaData40 
+     *
+     * @param columnMetaData ColumnMetaData
+     * @return a ParameterMetaData implementation
+     *
+     */
+    public ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData) {
+        return new ParameterMetaData40(columnMetaData);
     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java Wed Apr 19 06:46:42 2006
@@ -24,7 +24,6 @@
 import java.sql.QueryObjectFactory;
 import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.client.am.SqlException;
-import org.apache.derby.jdbc.InternalDriver;
 import java.sql.Blob;
 import java.sql.ClientInfoException;
 import java.sql.Clob;
@@ -32,11 +31,10 @@
 import java.sql.SQLException;
 import java.sql.SQLXML;
 import java.util.Properties;
-import org.apache.derby.client.am.SqlException;
 import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.jdbc.InternalDriver;
-
-
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class  NetConnection40 extends org.apache.derby.client.net.NetConnection {
     
@@ -159,6 +157,39 @@
     
     public java.util.Map<String,Class<?>> getTypeMap(){
         throw new java.lang.UnsupportedOperationException("getTypeMap()");
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
     }
     
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java Wed Apr 19 06:46:42 2006
@@ -23,7 +23,10 @@
 import java.sql.ResultSet;
 import java.sql.RowIdLifetime;
 import java.sql.SQLException;
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.SQLExceptionFactory;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class NetDatabaseMetaData40 extends org.apache.derby.client.net.NetDatabaseMetaData {
     
@@ -52,5 +55,38 @@
     public ResultSet getClientInfoProperties()
     throws SQLException {
         throw SQLExceptionFactory.notImplemented ("getClientInfoProperties ()");
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Wed Apr 19 06:46:42 2006
@@ -29,6 +29,10 @@
 import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.client.am.Cursor;
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.client.am.SqlException;
+import org.apache.derby.shared.common.reference.SQLState;
+
 
 public class NetResultSet40 extends NetResultSet{
     
@@ -103,6 +107,39 @@
     
     public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException {
         throw SQLExceptionFactory.notImplemented ("updateSQLXML (String, SQLXML)");
+    }
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
     }
     
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java Wed Apr 19 06:46:42 2006
@@ -24,6 +24,7 @@
 import org.apache.derby.client.am.Section;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.Statement;
+import org.apache.derby.jdbc.ClientDriver;
 
 public class NetStatement implements org.apache.derby.client.am.MaterialStatement {
 
@@ -74,7 +75,7 @@
 
     // Called by abstract Connection.createStatement().newStatement() for jdbc 1 statements
     NetStatement(NetAgent netAgent, NetConnection netConnection) throws SqlException {
-        this(new Statement(netAgent, netConnection),
+        this(ClientDriver.getFactory().newStatement(netAgent, netConnection),
                 netAgent,
                 netConnection);
     }
@@ -90,7 +91,7 @@
 
     // Called by abstract Connection.createStatement().newStatement() for jdbc 2 statements with scroll attributes
     NetStatement(NetAgent netAgent, NetConnection netConnection, int type, int concurrency, int holdability) throws SqlException {
-        this(new Statement(netAgent, netConnection, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null),
+        this(ClientDriver.getFactory().newStatement(netAgent, netConnection, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null),
                 netAgent,
                 netConnection);
     }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java Wed Apr 19 06:46:42 2006
@@ -125,7 +125,7 @@
             if (nullSqlca && peekNumOfColumns() == 0) {
                 netSqlca = parseSQLDARD(columnMetaData, true); // true means to skip the rest of SQLDARD bytes
             } else {
-                columnMetaData = new ColumnMetaData(netAgent_.logWriter_);
+                columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_);
                 netSqlca = parseSQLDARD(columnMetaData, false); // false means do not skip SQLDARD bytes.
             }
 
@@ -152,7 +152,7 @@
             ColumnMetaData columnMetaData = null;
 
             if (columnMetaData == null) {
-                columnMetaData = new ColumnMetaData(netAgent_.logWriter_);
+                columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_);
             }
 
             NetSqlca netSqlca = parseSQLDARD(columnMetaData, false);  // false means do not skip SQLDARD bytes
@@ -451,7 +451,7 @@
             peekCP = parseTypdefsOrMgrlvlovrs();
 
             if (peekCP == CodePoint.SQLDARD) {
-                ColumnMetaData columnMetaData = new ColumnMetaData(netAgent_.logWriter_);
+                ColumnMetaData columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_);
                 NetSqlca netSqlca = parseSQLDARD(columnMetaData, false);  // false means do not skip SQLDARD bytes
 
                 //For java stored procedure, we got the resultSetMetaData from server,
@@ -1890,7 +1890,7 @@
     // reply data in the response to an EXCSQLSTT command that invodes a stored
     // procedure
     ColumnMetaData parseSQLCINRDarray() throws DisconnectException {
-        ColumnMetaData columnMetaData = new ColumnMetaData(netAgent_.logWriter_);
+        ColumnMetaData columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_);
 
         parseSQLDHROW(columnMetaData);
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java Wed Apr 19 06:46:42 2006
@@ -24,6 +24,9 @@
 import java.sql.QueryObjectFactory;
 import java.sql.QueryObjectGenerator;
 import java.sql.SQLException;
+import org.apache.derby.client.am.MessageId;
+import org.apache.derby.client.am.SqlException;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class ClientDataSource40 extends ClientDataSource {
     
@@ -49,6 +52,39 @@
     public <T extends BaseQuery> T createQueryObject(Class<T> ifc) 
                                                     throws SQLException {
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
-    }        
+    }   
+    
+    /**
+     * Returns false unless <code>interfaces</code> is implemented 
+     * 
+     * @param  interfaces             a Class defining an interface.
+     * @return true                   if this implements the interface or 
+     *                                directly or indirectly wraps an object 
+     *                                that does.
+     * @throws java.sql.SQLException  if an error occurs while determining 
+     *                                whether this is a wrapper for an object 
+     *                                with the given interface.
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
+    }
+    
+    /**
+     * Returns <code>this</code> if this class implements the interface
+     *
+     * @param  interfaces a Class defining an interface
+     * @return an object that implements the interface
+     * @throws java.sql.SQLExption if no object if found that implements the 
+     * interface
+     */
+    public <T> T unwrap(java.lang.Class<T> interfaces)
+                                   throws SQLException {
+        try { 
+            return interfaces.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,new MessageId(SQLState.UNABLE_TO_UNWRAP),
+                    interfaces).getSQLException();
+        }
+    }
     
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java Wed Apr 19 06:46:42 2006
@@ -25,6 +25,7 @@
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.NClob;
+import java.sql.ParameterMetaData;
 import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
@@ -180,6 +181,25 @@
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException{
         throw Util.notImplemented ("setSQLXML (int, SQLXML)");
     }  
+    
+    /**
+    * JDBC 4.0
+    *
+    * Retrieves the number, types and properties of this CallableStatement
+    * object's parameters.
+    *
+    * @return a ParameterMetaData object that contains information about the
+    * number, types and properties of this CallableStatement object's parameters.
+    * @exception SQLException if a database access error occurs
+    *
+    */
+    public ParameterMetaData getParameterMetaData()
+        throws SQLException
+    {
+	  checkStatus();
+	  return new EmbedParameterMetaData40(
+				getParms(), preparedStatement.getParameterTypes());
+    }
     
     /**
      * Returns false unless <code>interfaces</code> is implemented 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java Wed Apr 19 06:46:42 2006
@@ -24,6 +24,7 @@
 import java.io.Reader;
 import java.sql.RowId;
 import java.sql.NClob;
+import java.sql.ParameterMetaData;
 import java.sql.SQLException;
 import java.sql.SQLXML;
 import java.sql.Types;
@@ -62,6 +63,25 @@
     
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException{
         throw Util.notImplemented();
+    }
+    
+   /**
+    * JDBC 4.0
+    *
+    * Retrieves the number, types and properties of this PreparedStatement
+    * object's parameters.
+    *
+    * @return a ParameterMetaData object that contains information about the
+    * number, types and properties of this PreparedStatement object's parameters.
+    * @exception SQLException if a database access error occurs
+    *
+    */
+    public ParameterMetaData getParameterMetaData()
+        throws SQLException
+    {
+	  checkStatus();
+	  return new EmbedParameterMetaData40(
+				getParms(), preparedStatement.getParameterTypes());
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude Wed Apr 19 06:46:42 2006
@@ -26,12 +26,8 @@
 jdbc4/TestDbMetaData.java
 jdbc4/TestJDBC40Exception.java
 jdbcapi/SURTest.junit
-#temporarily exclude until wrapper support for the client side is also added
-#begin
-jdbc4/DataSourceTest.junit
-jdbc4/ResultSetMetaDataTest.junit
+#Tests BrokeredConnection class which is presnt only on the embedded side
 jdbc4/EmbeddedBrokeredConnectionWrapperTest.junit
-#end
 #temporarily disable checkDataSourceTests with client
 #failing (hanging?)  on jdk 1.5/jdk 1.6
 jdbcapi/checkDataSource.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall Wed Apr 19 06:46:42 2006
@@ -10,4 +10,5 @@
 jdbc4/StatementTest.junit
 jdbc4/DataSourceTest.junit
 jdbc4/ResultSetMetaDataTest.junit
-jdbc4/EmbeddedBrokeredConnectionWrapperTest.junit
\ No newline at end of file
+jdbc4/EmbeddedBrokeredConnectionWrapperTest.junit
+jdbc4/ParameterMetaDataWrapperTest.junit
\ No newline at end of file

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java Wed Apr 19 06:46:42 2006
@@ -275,12 +275,6 @@
      *
      */
     public void testisWrapperReturnsTrue() throws SQLException {
-        //wrapper support is currently provided 
-        //only for embedded side so return if 
-        //running in DerbyNetClient framework
-        if(usingDerbyNetClient())
-            return;
-        
         Class<CallableStatement> wrap_class = CallableStatement.class;
         
         //The if should return true enabling us  to call the unwrap method
@@ -306,12 +300,6 @@
      *
      */
     public void testisWrapperReturnsFalse() throws SQLException {
-        //wrapper support is currently provided 
-        //only for embedded side so return if 
-        //running in DerbyNetClient framework
-         if(usingDerbyNetClient())
-            return;
-         
         //test for the case when isWrapper returns false
         //using some class that will return false when
         //passed to isWrapperFor

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java?rev=395245&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java Wed Apr 19 06:46:42 2006
@@ -0,0 +1,141 @@
+/*
+ 
+   Derby - Class org.apache.derbyTesting.functionTests.tests.jdbc4.ParameterMetaDataWrapperTest
+ 
+   Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+ */
+package org.apache.derbyTesting.functionTests.tests.jdbc4;
+
+import java.sql.*;
+import javax.sql.*;
+import junit.framework.*;
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
+
+/**
+ * Tests of the <code>java.sql.ParameterMetaData</code> JDBC40 API
+ */
+public class ParameterMetaDataWrapperTest extends BaseJDBCTestCase {
+    
+    //Default Connection used by the tests
+    Connection conn = null;
+    //Default PreparedStatement used by the tests
+    PreparedStatement ps = null;
+    //Default ParameterMetaData object used by the tests
+    ParameterMetaData pmd = null;
+    
+    /**
+     * Create a test with the given name
+     *
+     * @param name String name of the test
+     */
+    public ParameterMetaDataWrapperTest(String name) {
+        super(name);
+    }
+    
+    /**
+     * Create a default Prepared Statement and connection.
+     *
+     * @throws SQLException if creation of connection or callable statement
+     *                      fail.
+     */
+    public void setUp() 
+        throws SQLException {
+        conn = getConnection();
+        ps   = conn.prepareStatement("values 1");
+        pmd  = ps.getParameterMetaData();
+    }
+
+    /**
+     * Close default Prepared Statement and connection.
+     *
+     * @throws SQLException if closing of the connection or the callable
+     *                      statement fail.
+     */
+    public void tearDown()
+        throws SQLException {
+        if(ps != null && !ps.isClosed())
+            ps.close();
+        if(conn != null && !conn.isClosed())
+            conn.close();
+    }
+    
+    /**
+     *
+     * Tests the wrapper methods isWrapperFor and unwrap. Test
+     * for the case when isWrapperFor returns true and we call unwrap
+     * The test is right now being run in the embedded case only
+     *
+     */
+    public void testisWrapperReturnsTrue() throws SQLException {
+        Class<ParameterMetaData> wrap_class = ParameterMetaData.class;
+        
+        //The if should return true enabling us  to call the unwrap method
+        //without throwing  an exception
+        if(pmd.isWrapperFor(wrap_class)) {
+            try {
+                ParameterMetaData pmd1 =
+                        (ParameterMetaData)pmd.unwrap(wrap_class);
+            }
+            catch(SQLException sqle) {
+                fail("Unwrap wrongly throws a SQLException");
+            }
+        } else {
+            fail("isWrapperFor wrongly returns false");
+        }
+    }
+    
+    /**
+     *
+     * Tests the wrapper methods isWrapperFor and unwrap. Test
+     * for the case when isWrapperFor returns false and we call unwrap
+     * The test is right now being run in the embedded case only
+     *
+     */
+    public void testisWrapperReturnsFalse() throws SQLException {
+        //test for the case when isWrapper returns false
+        //using some class that will return false when
+        //passed to isWrapperFor
+        Class<ResultSet> wrap_class = ResultSet.class;
+        
+        //returning false is the correct behaviour in this case
+        //Generate a message if it returns true
+        if(pmd.isWrapperFor(wrap_class)) {
+            fail("isWrapperFor wrongly returns true");
+        } else {
+            try {
+                ResultSet rs1 = (ResultSet)
+                pmd.unwrap(wrap_class);
+                fail("unwrap does not throw the expected " +
+                        "exception");
+            } catch (SQLException sqle) {
+                //calling unwrap in this case throws an SQLException
+                //check that this SQLException has the correct SQLState
+                if(!SQLStateConstants.UNABLE_TO_UNWRAP.equals(sqle.getSQLState())) {
+                    throw sqle;
+                }
+            }
+        }
+    }
+    
+    /**
+     * Return suite with all tests of the class.
+     */
+    public static Test suite() {
+        return (new TestSuite(ParameterMetaDataWrapperTest.class,
+                              "ParameterMetaDataWrapperTest suite"));
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java Wed Apr 19 06:46:42 2006
@@ -240,12 +240,6 @@
      *
      */
     public void testisWrapperReturnsTrue() throws SQLException {
-        //wrapper support is currently provided 
-        //only for embedded side so return if 
-        //running in DerbyNetClient framework
-        if(usingDerbyNetClient())
-            return;
-        
         Class<Statement> wrap_class = Statement.class;
         
         //The if should return true enabling us  to call the unwrap method
@@ -271,12 +265,6 @@
      *
      */
     public void testisWrapperReturnsFalse() throws SQLException {
-        //wrapper support is currently provided 
-        //only for embedded side so return if 
-        //running in DerbyNetClient framework
-         if(usingDerbyNetClient())
-            return;
-         
         //test for the case when isWrapper returns false
         //using some class that will return false when
         //passed to isWrapperFor

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java Wed Apr 19 06:46:42 2006
@@ -440,6 +440,7 @@
         t_setClientInfo2();
         t_getClientInfo1();
         t_getClientInfo2();
+        t_wrapper();
     }
     
     public void startTestConnectionMethods_Embedded() {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java Wed Apr 19 06:46:42 2006
@@ -169,8 +169,7 @@
             dumpSQLExceptions(e);
         }
         
-        if(usingEmbeddedClient())
-            t_wrapper(met);
+        t_wrapper(met);
         
         s.close();
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java Wed Apr 19 06:46:42 2006
@@ -573,6 +573,7 @@
                                  // poolable hint set/get test methods below
             t_isPoolable();
             t_setPoolable();
+            t_wrapper();
         } catch(SQLException sqle) {
             sqle.printStackTrace();
         } finally {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java?rev=395245&r1=395244&r2=395245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java Wed Apr 19 06:46:42 2006
@@ -614,8 +614,7 @@
 			TestResultSetMethods trsm = new TestResultSetMethods();
                         
 			trsm.startTestResultSetMethods(conn_main,ps_main,rs_main);
-                        if(usingEmbeddedClient())
-                            trsm.t_wrapper(rs_main);
+                        trsm.t_wrapper(rs_main);
 		} catch(Exception e) {
 			System.out.println(""+e);
 			e.printStackTrace();