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/06/07 02:10:25 UTC

svn commit: r412239 - 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/iapi/jdbc/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/jdbc/...

Author: rhillegas
Date: Tue Jun  6 17:10:25 2006
New Revision: 412239

URL: http://svn.apache.org/viewvc?rev=412239&view=rev
Log:
DERBY-1380: derby-1380.v2.diff, adding new overloads for createQueryObject().

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestQueryObject.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection40.java Tue Jun  6 17:10:25 2006
@@ -82,6 +82,12 @@
 		return physicalConnection_.createQueryObject( ifc );
     }
     
+    public <T extends BaseQuery>T createQueryObject(Class<T> ifc, java.sql.Connection conn)
+        throws SQLException {
+		checkForNullPhysicalConnection();
+		return physicalConnection_.createQueryObject( ifc, conn );
+    }
+    
     public SQLXML createSQLXML()
         throws SQLException {
 		checkForNullPhysicalConnection();

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java?rev=412239&r1=412238&r2=412239&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 Tue Jun  6 17:10:25 2006
@@ -28,6 +28,7 @@
 import java.sql.Blob;
 import java.sql.SQLClientInfoException;
 import java.sql.Clob;
+import java.sql.Connection;
 import java.sql.NClob;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -398,6 +399,23 @@
             throw se.getSQLException();
         }
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
+    } 
+    
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param conn Connection to use when invoking methods that access the Data Source
+     * @return concreat class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, Connection conn ) 
+                                                    throws SQLException {
+        try {
+            checkForClosedConnection();
+        } catch (SqlException se) {
+            throw se.getSQLException();
+        }
+        return QueryObjectFactory.createDefaultQueryObject (ifc, conn);
     } 
     
     /**

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java Tue Jun  6 17:10:25 2006
@@ -24,6 +24,7 @@
 import java.sql.QueryObjectFactory;
 import java.sql.QueryObjectGenerator;
 import java.sql.SQLException;
+import javax.sql.DataSource;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -67,6 +68,18 @@
     public <T extends BaseQuery> T createQueryObject(Class<T> ifc) 
                                                     throws SQLException {
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
+    }   
+    
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concreat class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
     }   
     
     /**

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java?rev=412239&r1=412238&r2=412239&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 Tue Jun  6 17:10:25 2006
@@ -24,6 +24,7 @@
 import java.sql.QueryObjectFactory;
 import java.sql.QueryObjectGenerator;
 import java.sql.SQLException;
+import javax.sql.DataSource;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -125,6 +126,18 @@
     public <T extends BaseQuery> T createQueryObject(Class<T> ifc) 
                                                     throws SQLException {
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
+    }   
+    
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concreat class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
     }   
     
     /**

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java Tue Jun  6 17:10:25 2006
@@ -24,6 +24,7 @@
 import java.sql.QueryObjectFactory;
 import java.sql.QueryObjectGenerator;
 import java.sql.SQLException;
+import javax.sql.DataSource;
 import javax.sql.XAConnection;
 import org.apache.derby.client.ClientXAConnection40;
 import org.apache.derby.client.am.ClientMessageId;
@@ -93,6 +94,18 @@
     }   
     
     /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
+    }   
+    
+	/**
      * Returns false unless <code>interfaces</code> is implemented 
      * 
      * @param  interfaces             a Class defining an interface.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java Tue Jun  6 17:10:25 2006
@@ -24,6 +24,7 @@
 import java.sql.BaseQuery;
 import java.sql.Blob;
 import java.sql.Clob;
+import java.sql.Connection;
 import java.sql.SQLClientInfoException;
 import java.sql.NClob;
 import java.sql.SQLException;
@@ -270,6 +271,26 @@
         }
     }
     
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param conn Connection to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, Connection conn ) 
+		throws SQLException {
+        if (isClosed()) {
+            throw Util.noCurrentConnection();
+        }
+        try {
+            return getRealConnection().createQueryObject(ifc, conn);
+        } catch (SQLException sqle) {
+            notifyException(sqle);
+            throw sqle;
+        }
+    }
+
     /**
      * returns an instance of JDBC4.0 speccific class BrokeredStatement40
      * @param  statementControl BrokeredStatementControl

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java Tue Jun  6 17:10:25 2006
@@ -25,6 +25,7 @@
 import java.sql.Blob;
 import java.sql.SQLClientInfoException;
 import java.sql.Clob;
+import java.sql.Connection;
 import java.sql.NClob;
 import java.sql.QueryObjectFactory;
 import java.sql.SQLException;
@@ -268,6 +269,19 @@
                                                     throws SQLException {
         checkIfClosed();
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
+    } 
+    
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param conn Connection to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, Connection conn ) 
+                                                    throws SQLException {
+        checkIfClosed();
+        return QueryObjectFactory.createDefaultQueryObject (ifc, conn);
     } 
     
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java Tue Jun  6 17:10:25 2006
@@ -24,6 +24,7 @@
 import java.sql.QueryObjectGenerator;
 import java.sql.SQLException;
 import javax.sql.ConnectionPoolDataSource;
+import javax.sql.DataSource;
 import javax.sql.PooledConnection;
 
 import org.apache.derby.impl.jdbc.Util;
@@ -106,13 +107,25 @@
      * This method forwards all the calls to default query object provided by 
      * the jdk.
      * @param ifc interface to generated concreate class
-     * @return concreat class generated by default qury object generator
+     * @return concrete class generated by default qury object generator
      */
     public <T extends BaseQuery> T createQueryObject(Class<T> ifc) 
                                                     throws SQLException {
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
     }
     
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
+    }   
+
     /**
      * create and returns EmbedPooledConnection.
      */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java Tue Jun  6 17:10:25 2006
@@ -23,9 +23,10 @@
 import java.sql.BaseQuery;
 import java.sql.QueryObjectFactory;
 import java.sql.QueryObjectGenerator;
-import org.apache.derby.impl.jdbc.Util;
 import java.sql.SQLException;
+import javax.sql.DataSource;
 
+import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.iapi.reference.SQLState;
 
 /** 
@@ -205,6 +206,18 @@
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
     }        
     
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
+    }   
+
     /**
      * Returns false unless <code>interfaces</code> is implemented 
      * 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java Tue Jun  6 17:10:25 2006
@@ -26,6 +26,7 @@
 import org.apache.derby.iapi.jdbc.ResourceAdapter;
 
 import java.sql.SQLException;
+import javax.sql.DataSource;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
@@ -121,6 +122,18 @@
         return QueryObjectFactory.createDefaultQueryObject (ifc, this);
     } 
     
+    /**
+     * This method forwards all the calls to default query object provided by 
+     * the jdk.
+     * @param ifc interface to generated concreate class
+     * @param dataSource DataSource to use when invoking methods that access the Data Source
+     * @return concrete class generated by default qury object generator
+     */
+    public <T extends BaseQuery> T createQueryObject(Class<T> ifc, DataSource dataSource ) 
+                                                    throws SQLException {
+        return QueryObjectFactory.createDefaultQueryObject (ifc, dataSource);
+    }   
+
     /**
      * Intantiate and returns EmbedXAConnection.
      * @param user 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java Tue Jun  6 17:10:25 2006
@@ -151,6 +151,7 @@
     public void testCreateQueryObjectIsImplemented()
         throws SQLException {
         con.createQueryObject(TestQuery.class);
+        con.createQueryObject(TestQuery.class, con);
     }
 
     public void testCreateSQLXMLNotImplemented()

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestQueryObject.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestQueryObject.java?rev=412239&r1=412238&r2=412239&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestQueryObject.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestQueryObject.java Tue Jun  6 17:10:25 2006
@@ -57,13 +57,23 @@
      * @param con 
      */
     public static void testConnectionQuery (Connection con) throws Exception {
-        TestQuery query = con.createQueryObject (TestQuery.class);
+
+		vetQueryObject( con.createQueryObject (TestQuery.class) );
+		vetQueryObject( con.createQueryObject (TestQuery.class, con) );
+    }
+    
+    /**
+     * Verify the contents of query object
+     */
+	private	static	void	vetQueryObject( TestQuery query )
+		throws Exception
+	{
         if (query.getAllData().size() != RECORD_COUNT)
             System.out.println ("expected result size 10 actual " 
                     + query.getAllData().size());
         query.close();
-    }
-    
+	}
+
     /**
      * Tests DataSource.createQueryObject
      * @param ds