From derby-commits-return-12055-apmail-db-derby-commits-archive=db.apache.org@db.apache.org Tue Sep 01 20:14:13 2009 Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 6866 invoked from network); 1 Sep 2009 20:14:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Sep 2009 20:14:13 -0000 Received: (qmail 9048 invoked by uid 500); 1 Sep 2009 20:14:13 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 9000 invoked by uid 500); 1 Sep 2009 20:14:13 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 8991 invoked by uid 99); 1 Sep 2009 20:14:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 20:14:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 20:14:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9BBDD23888E5; Tue, 1 Sep 2009 20:13:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r810210 - in /db/derby/code/branches/10.3: ./ java/engine/org/apache/derby/iapi/jdbc/ java/engine/org/apache/derby/jdbc/ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Tue, 01 Sep 2009 20:13:47 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090901201347.9BBDD23888E5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Tue Sep 1 20:13:46 2009 New Revision: 810210 URL: http://svn.apache.org/viewvc?rev=810210&view=rev Log: DERBY-4310 Merging changes into 10.3 codeline Modified: db/derby/code/branches/10.3/ (props changed) db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java db/derby/code/branches/10.3/java/engine/org/apache/derby/jdbc/XAStatementControl.java db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Propchange: db/derby/code/branches/10.3/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 1 20:13:46 2009 @@ -1 +1 @@ -/db/derby/code/trunk:552046,788436,793588 +/db/derby/code/trunk:552046,788436,793588,800523 Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java (original) +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java Tue Sep 1 20:13:46 2009 @@ -60,6 +60,10 @@ return getCallableStatement().wasNull(); } + public final void close() throws SQLException { + control.closeRealCallableStatement(); + } + public final String getString(int parameterIndex) throws SQLException { Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java (original) +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java Tue Sep 1 20:13:46 2009 @@ -73,6 +73,11 @@ return getPreparedStatement().executeUpdate(); } + public void close() throws SQLException + { + control.closeRealPreparedStatement(); + } + /** * Set a parameter to SQL NULL. * Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java (original) +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java Tue Sep 1 20:13:46 2009 @@ -125,9 +125,9 @@ * ResultSet, if one exists, is also closed. * @exception SQLException thrown on failure. */ - public final void close() throws SQLException + public void close() throws SQLException { - getStatement().close(); + control.closeRealStatement(); } public final Connection getConnection() Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java (original) +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java Tue Sep 1 20:13:46 2009 @@ -37,6 +37,26 @@ public int checkHoldCursors(int holdability) throws SQLException; /** + * Close the real JDBC Statement when this is controlling a Statement. + * @throws SQLException + */ + public void closeRealStatement() throws SQLException; + + /** + * Close the real JDBC CallableStatement when this is controlling a + * CallableStatement. + * @throws SQLException + */ + public void closeRealCallableStatement() throws SQLException; + + /** + * Close the real JDBC CallableStatement when this is controlling a + * PreparedStatement. + * @throws SQLException + */ + public void closeRealPreparedStatement() throws SQLException; + + /** Return the real JDBC statement for the brokered statement when this is controlling a Statement. */ Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/jdbc/XAStatementControl.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/jdbc/XAStatementControl.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/engine/org/apache/derby/jdbc/XAStatementControl.java (original) +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/jdbc/XAStatementControl.java Tue Sep 1 20:13:46 2009 @@ -85,6 +85,27 @@ applicationStatement); } + /** + * Close the realStatement within this control. + */ + public void closeRealStatement() throws SQLException { + realStatement.close(); + } + + /** + * Close the realCallableStatement within this control. + */ + public void closeRealCallableStatement() throws SQLException { + realCallableStatement.close(); + } + + /** + * Close the realPreparedStatement within this control. + */ + public void closeRealPreparedStatement() throws SQLException { + realPreparedStatement.close(); + } + public Statement getRealStatement() throws SQLException { // Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java (original) +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Tue Sep 1 20:13:46 2009 @@ -21,6 +21,7 @@ package org.apache.derbyTesting.functionTests.tests.jdbcapi; +import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -167,6 +168,11 @@ * transaction xa_commit xa_1Phase 3; disconnect; */ public void testInterleavingTransactions() throws SQLException, XAException { + Statement preStatement = getConnection().createStatement(); + preStatement.execute("create table fooInterleaving (a int)"); + preStatement.execute("insert into fooInterleaving values (0)"); + preStatement.close(); + XADataSource xads = J2EEDataSource.getXADataSource(); XAConnection xac = xads.getXAConnection("sku", "testxa"); @@ -180,19 +186,19 @@ Connection conn = xac.getConnection(); Statement s = conn.createStatement(); - s.executeUpdate("insert into APP.foo values (1)"); + s.executeUpdate("insert into APP.fooInterleaving values (1)"); xar.end(xid1, XAResource.TMSUSPEND); xar.start(xid2, XAResource.TMNOFLAGS); - s.executeUpdate("insert into APP.foo values (2)"); + s.executeUpdate("insert into APP.fooInterleaving values (2)"); xar.end(xid2, XAResource.TMSUSPEND); xar.start(xid1, XAResource.TMRESUME); - s.executeUpdate("insert into APP.foo values (3)"); + s.executeUpdate("insert into APP.fooInterleaving values (3)"); xar.end(xid1, XAResource.TMSUSPEND); xar.start(xid2, XAResource.TMRESUME); - s.executeUpdate("insert into APP.foo values (4)"); + s.executeUpdate("insert into APP.fooInterleaving values (4)"); String[][] expectedRows = { { "(1", "ACTIVE", "false", "SKU", "UserTransaction" }, @@ -255,7 +261,7 @@ expectedRows = new String[][] { { "(3", "IDLE", "NULL", "SKU", "UserTransaction" } }; XATestUtil.checkXATransactionView(conn, expectedRows); - ResultSet rs = s.executeQuery("select * from APP.foo"); + ResultSet rs = s.executeQuery("select * from APP.fooInterleaving"); expectedRows = new String[][] { { "0" }, { "1" }, { "3" } }; JDBC.assertFullResultSet(rs, expectedRows); @@ -382,7 +388,15 @@ * Morph a connection between local anf global transactions. */ public void testMorph() throws SQLException, XAException { - + Statement preStatement = getConnection().createStatement(); + preStatement.execute("create table fooMorph (a int)"); + preStatement.executeUpdate("insert into APP.fooMorph values (0)"); + preStatement.executeUpdate("insert into APP.fooMorph values (1)"); + preStatement.executeUpdate("insert into APP.fooMorph values (2)"); + preStatement.executeUpdate("insert into APP.fooMorph values (3)"); + preStatement.executeUpdate("insert into APP.fooMorph values (4)"); + preStatement.close(); + XADataSource xads = J2EEDataSource.getXADataSource(); XAConnection xac = xads.getXAConnection(); @@ -397,7 +411,7 @@ */ conn.setAutoCommit(false); Statement s = conn.createStatement(); - s.executeUpdate("insert into APP.foo values (2001)"); + s.executeUpdate("insert into APP.fooMorph values (2001)"); // no rows expected XATestUtil.checkXATransactionView(conn, null); conn.commit(); @@ -409,7 +423,7 @@ */ conn.setAutoCommit(true); - s.executeUpdate("insert into APP.foo values (2002)"); + s.executeUpdate("insert into APP.fooMorph values (2002)"); XATestUtil.checkXATransactionView(conn, null); /* @@ -423,7 +437,7 @@ String[][] expectedRows = { { "(1", "IDLE", "NULL", "APP", "UserTransaction" } }; XATestUtil.checkXATransactionView(conn, expectedRows); - s.executeUpdate("insert into APP.foo values (2003)"); + s.executeUpdate("insert into APP.fooMorph values (2003)"); /* * -- disallowed commit; -- disallowed rollback; -- disallowed @@ -462,7 +476,7 @@ // set, will execute but ResultSet will have close on commit // DERBY-1158 query with holdable statement - s.executeQuery("select * from APP.foo where A >= 2000").close(); + s.executeQuery("select * from APP.fooMorph where A >= 2000").close(); s.close(); // statement created in global xact is CLOSE_CURSORS_AT_COMMIT @@ -473,7 +487,7 @@ /* * select * from foo; xa_end xa_success 1; xa_prepare 1; */ - ResultSet rs = s.executeQuery("select * from APP.foo where A >= 2000"); + ResultSet rs = s.executeQuery("select * from APP.fooMorph where A >= 2000"); expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" } }; rs.close(); @@ -533,12 +547,12 @@ */ conn = xac.getConnection(); s = conn.createStatement(); - s.executeUpdate("insert into APP.foo values (2005)"); + s.executeUpdate("insert into APP.fooMorph values (2005)"); conn.commit(); conn.setAutoCommit(false); - s.executeUpdate("insert into APP.foo values (2006)"); + s.executeUpdate("insert into APP.fooMorph values (2006)"); conn.rollback(); - s.executeUpdate("insert into APP.foo values (2007)"); + s.executeUpdate("insert into APP.fooMorph values (2007)"); conn.commit(); expectedRows = new String[][] { @@ -555,7 +569,7 @@ xar.rollback(xid2); XATestUtil.checkXATransactionView(conn, null); - rs = s.executeQuery("select * from APP.foo where A >= 2000"); + rs = s.executeQuery("select * from APP.fooMorph where A >= 2000"); expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" }, { "2005" }, { "2007" } }; JDBC.assertFullResultSet(rs, expectedRows); @@ -571,8 +585,8 @@ conn = xac.getConnection(); conn.setAutoCommit(false); s = conn.createStatement(); - s.executeUpdate("delete from app.foo"); - rs = s.executeQuery("select * from APP.foo"); + s.executeUpdate("delete from app.fooMorph"); + rs = s.executeQuery("select * from APP.fooMorph"); JDBC.assertEmpty(rs); rs.close(); @@ -582,7 +596,7 @@ conn = xac.getConnection(); conn.setAutoCommit(false); s = conn.createStatement(); - rs = s.executeQuery("select * from APP.foo where A >= 2000"); + rs = s.executeQuery("select * from APP.fooMorph where A >= 2000"); expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" }, { "2005" }, { "2007" } }; JDBC.assertFullResultSet(rs, expectedRows); @@ -623,8 +637,8 @@ * null order by gxid,username; select * from foo; */ s = conn.createStatement(); - s.executeUpdate("delete from APP.foo"); - rs = s.executeQuery("select * from APP.foo where A >= 2000"); + s.executeUpdate("delete from APP.fooMorph"); + rs = s.executeQuery("select * from APP.fooMorph where A >= 2000"); JDBC.assertEmpty(rs); rs.close(); @@ -638,7 +652,7 @@ conn = xac.getConnection(); s = conn.createStatement(); - rs = s.executeQuery("select * from APP.foo where A >= 2000"); + rs = s.executeQuery("select * from APP.fooMorph where A >= 2000"); expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" }, { "2005" }, { "2007" } }; JDBC.assertFullResultSet(rs, expectedRows); @@ -650,10 +664,124 @@ } /** + * This test checks the fix on DERBY-4310, for not repreparing PreparedStatements + * upon calling close() on them. + */ + public void testDerby4310PreparedStatement() throws SQLException, XAException { + XADataSource xads = J2EEDataSource.getXADataSource(); + J2EEDataSource.setBeanProperty(xads, "databaseName", "wombat"); + + XAConnection xaconn = xads.getXAConnection(); + + XAResource xar = xaconn.getXAResource(); + Xid xid = XATestUtil.getXid(1,93,18); + + /* Create the table and insert some records into it. */ + Connection conn = xaconn.getConnection(); + Statement s = conn.createStatement(); + s.executeUpdate("CREATE TABLE foo4310_PS (I INT)"); + + conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (0)"); + conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (1)"); + conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (2)"); + conn.commit(); + + /* Prepare and execute the statement to be tested */ + PreparedStatement ps = conn.prepareStatement("SELECT * FROM APP.foo4310_PS"); + ps.executeQuery().close(); + + /* Start and end a transaction on the XAResource object */ + xar.start(xid, XAResource.TMNOFLAGS); + xar.end(xid, XAResource.TMSUCCESS); + + /* Drop the table on a parallel, regular connection */ + Connection conn2 = getConnection(); + Statement s2 = conn2.createStatement(); + s2.execute("DROP TABLE foo4310_PS"); + conn2.commit(); + conn2.close(); + + try { + /* Try to close the prepared statement. This would throw an exception + * before the fix, claiming that the table was not found. */ + ps.close(); + } finally { + /* Rollback the transaction and close the connections */ + xar.rollback(xid); + conn.close(); + xaconn.close(); + } + + } + + /** + * This test checks the fix on DERBY-4310, for not repreparing CallableStatements + * upon calling close() on them. + */ + public void testDerby4310CallableStatement() throws SQLException, XAException { + XADataSource xads = J2EEDataSource.getXADataSource(); + J2EEDataSource.setBeanProperty(xads, "databaseName", "wombat"); + + XAConnection xaconn = xads.getXAConnection(); + + XAResource xar = xaconn.getXAResource(); + Xid xid = XATestUtil.getXid(1,93,18); + + /* Create the procedure bazed on XATest.zeroArg() */ + Connection conn = xaconn.getConnection(); + Statement s = conn.createStatement(); + s.executeUpdate("CREATE PROCEDURE ZA() LANGUAGE JAVA "+ + "EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.jdbcapi.XATest.zeroArg' "+ + "PARAMETER STYLE JAVA"); + conn.commit(); + + /* Prepare and execute CallableStatement based on the procedure above */ + CallableStatement cs = conn.prepareCall("CALL ZA()"); + cs.execute(); + + /* Start and end a transaction on the XAResource object */ + xar.start(xid, XAResource.TMNOFLAGS); + xar.end(xid, XAResource.TMSUCCESS); + + /* Drop the procedure on a parallel, regular connection */ + Connection conn2 = getConnection(); + Statement s2 = conn2.createStatement(); + s2.execute("DROP PROCEDURE ZA"); + conn2.commit(); + conn2.close(); + + try { + /* Try to close the prepared statement. This would throw an exception + * before the fix, claiming that the table was not found. */ + cs.close(); + } finally { + /* Rollback the transaction and close the connections */ + xar.rollback(xid); + conn.close(); + xaconn.close(); + } + + } + + /** * Derby-966 holdability and global/location transactions. (work in * progress) */ public void testDerby966() throws SQLException, XAException { + Statement preStatement = getConnection().createStatement(); + preStatement.execute("create table foo966 (a int)"); + preStatement.executeUpdate("insert into APP.foo966 values (0)"); + preStatement.executeUpdate("insert into APP.foo966 values (1)"); + preStatement.executeUpdate("insert into APP.foo966 values (2)"); + preStatement.executeUpdate("insert into APP.foo966 values (3)"); + preStatement.executeUpdate("insert into APP.foo966 values (4)"); + preStatement.executeUpdate("insert into APP.foo966 values (2001)"); + preStatement.executeUpdate("insert into APP.foo966 values (2002)"); + preStatement.executeUpdate("insert into APP.foo966 values (2003)"); + preStatement.executeUpdate("insert into APP.foo966 values (2005)"); + preStatement.executeUpdate("insert into APP.foo966 values (2007)"); + preStatement.close(); + XADataSource xads = J2EEDataSource.getXADataSource(); XAConnection xac = xads.getXAConnection(); XAResource xar = xac.getXAResource(); @@ -670,10 +798,10 @@ assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, sdh .getResultSetHoldability()); - checkHeldRS(conn, sdh, sdh.executeQuery("select * from app.foo")); - PreparedStatement psdh = conn.prepareStatement("SELECT * FROM APP.FOO"); + checkHeldRS(conn, sdh, sdh.executeQuery("select * from app.foo966")); + PreparedStatement psdh = conn.prepareStatement("SELECT * FROM APP.foo966"); PreparedStatement psdh_d = conn - .prepareStatement("DELETE FROM APP.FOO WHERE A < -99"); + .prepareStatement("DELETE FROM APP.foo966 WHERE A < -99"); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, psdh .getResultSetHoldability()); checkHeldRS(conn, psdh, psdh.executeQuery()); @@ -682,12 +810,12 @@ ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, shh .getResultSetHoldability()); - checkHeldRS(conn, shh, shh.executeQuery("select * from app.foo")); - PreparedStatement pshh = conn.prepareStatement("SELECT * FROM APP.FOO", + checkHeldRS(conn, shh, shh.executeQuery("select * from app.foo966")); + PreparedStatement pshh = conn.prepareStatement("SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); PreparedStatement pshh_d = conn.prepareStatement( - "DELETE FROM APP.FOO WHERE A < -99", + "DELETE FROM APP.foo966 WHERE A < -99", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, shh @@ -699,12 +827,12 @@ assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, sch .getResultSetHoldability()); - checkHeldRS(conn, sch, sch.executeQuery("select * from app.foo")); - PreparedStatement psch = conn.prepareStatement("SELECT * FROM APP.FOO", + checkHeldRS(conn, sch, sch.executeQuery("select * from app.foo966")); + PreparedStatement psch = conn.prepareStatement("SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); PreparedStatement psch_d = conn.prepareStatement( - "DELETE FROM APP.FOO WHERE A < -99", + "DELETE FROM APP.foo966 WHERE A < -99", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psch_d @@ -717,10 +845,10 @@ Statement sdc = conn.createStatement(); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, sdc .getResultSetHoldability()); - checkHeldRS(conn, sdc, sdc.executeQuery("select * from app.foo")); - PreparedStatement psdc = conn.prepareStatement("SELECT * FROM APP.FOO"); + checkHeldRS(conn, sdc, sdc.executeQuery("select * from app.foo966")); + PreparedStatement psdc = conn.prepareStatement("SELECT * FROM APP.foo966"); PreparedStatement psdc_d = conn - .prepareStatement("DELETE FROM APP.FOO WHERE A < -99"); + .prepareStatement("DELETE FROM APP.foo966 WHERE A < -99"); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psdc .getResultSetHoldability()); checkHeldRS(conn, psdc, psdc.executeQuery()); @@ -729,12 +857,12 @@ ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psdc .getResultSetHoldability()); - checkHeldRS(conn, shc, shc.executeQuery("select * from app.foo")); - PreparedStatement pshc = conn.prepareStatement("SELECT * FROM APP.FOO", + checkHeldRS(conn, shc, shc.executeQuery("select * from app.foo966")); + PreparedStatement pshc = conn.prepareStatement("SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); PreparedStatement pshc_d = conn.prepareStatement( - "DELETE FROM APP.FOO WHERE A < -99", + "DELETE FROM APP.foo966 WHERE A < -99", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, pshc @@ -746,12 +874,12 @@ ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, scc .getResultSetHoldability()); - checkHeldRS(conn, scc, scc.executeQuery("select * from app.foo")); - PreparedStatement pscc = conn.prepareStatement("SELECT * FROM APP.FOO", + checkHeldRS(conn, scc, scc.executeQuery("select * from app.foo966")); + PreparedStatement pscc = conn.prepareStatement("SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); PreparedStatement pscc_d = conn.prepareStatement( - "DELETE FROM APP.FOO WHERE A < -99", + "DELETE FROM APP.foo966 WHERE A < -99", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, pscc @@ -762,7 +890,7 @@ // Revert back to holdable conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT); - ResultSet rs = sdh.executeQuery("SELECT * FROM APP.FOO"); + ResultSet rs = sdh.executeQuery("SELECT * FROM APP.foo966"); rs.next(); // before commit assertEquals(0, +rs.getInt(1)); @@ -773,7 +901,7 @@ rs.close(); // ensure a transaction is active to test DERBY-1025 - rs = sdh.executeQuery("SELECT * FROM APP.FOO"); + rs = sdh.executeQuery("SELECT * FROM APP.foo966"); // This switch to global is ok because conn // is in auto-commit mode, thus the start performs @@ -783,18 +911,18 @@ xar.start(xid, XAResource.TMNOFLAGS); // Statements not returning ResultSet's should be ok - sdh.executeUpdate("DELETE FROM APP.FOO where A < -99"); - shh.executeUpdate("DELETE FROM APP.FOO where A < -99"); - sch.executeUpdate("DELETE FROM APP.FOO where A < -99"); + sdh.executeUpdate("DELETE FROM APP.foo966 where A < -99"); + shh.executeUpdate("DELETE FROM APP.foo966 where A < -99"); + sch.executeUpdate("DELETE FROM APP.foo966 where A < -99"); ArrayList openRS = new ArrayList(); // Statements obtained while default was hold. // All should work, holability will be downgraded // to close on commit for those Statements with hold set. - openRS.add(sdh.executeQuery("SELECT * FROM APP.FOO")); - openRS.add(shh.executeQuery("SELECT * FROM APP.FOO")); - openRS.add(sch.executeQuery("SELECT * FROM APP.FOO")); + openRS.add(sdh.executeQuery("SELECT * FROM APP.foo966")); + openRS.add(shh.executeQuery("SELECT * FROM APP.foo966")); + openRS.add(sch.executeQuery("SELECT * FROM APP.foo966")); // PreparedStatements obtained while default was hold. // Holdability should be downgraded. @@ -808,15 +936,15 @@ psch_d.executeUpdate(); // Statements not returning ResultSet's should be ok - sdc.executeUpdate("DELETE FROM APP.FOO where A < -99"); - shc.executeUpdate("DELETE FROM APP.FOO where A < -99"); - scc.executeUpdate("DELETE FROM APP.FOO where A < -99"); + sdc.executeUpdate("DELETE FROM APP.foo966 where A < -99"); + shc.executeUpdate("DELETE FROM APP.foo966 where A < -99"); + scc.executeUpdate("DELETE FROM APP.foo966 where A < -99"); // Statements obtained while default was close. // all should return close on commit ResultSets - openRS.add(sdc.executeQuery("SELECT * FROM APP.FOO")); - openRS.add(shc.executeQuery("SELECT * FROM APP.FOO")); - openRS.add(scc.executeQuery("SELECT * FROM APP.FOO")); + openRS.add(sdc.executeQuery("SELECT * FROM APP.foo966")); + openRS.add(shc.executeQuery("SELECT * FROM APP.foo966")); + openRS.add(scc.executeQuery("SELECT * FROM APP.foo966")); // PreparedStatements obtained while default was close. openRS.add(psdc.executeQuery()); @@ -863,7 +991,7 @@ // DERBY2481 Client does not downgrade PreparedStatement holdability if (!usingDerbyNetClient()) { PreparedStatement psglobalhold = conn.prepareStatement( - "SELECT * FROM APP.FOO", ResultSet.TYPE_FORWARD_ONLY, + "SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psglobalhold @@ -991,6 +1119,11 @@ rs.close(); conn.commit(); } + + /** + * Dummy method for testDerby4310* fixtures + */ + public static void zeroArg() { } public static Test baseSuite(String name) { TestSuite suite = new TestSuite(name); @@ -1018,6 +1151,7 @@ // no XA for JSR169 if (JDBC.vmSupportsJSR169()) return suite; + suite.addTest(baseSuite("XATest:embedded")); suite.addTest(TestConfiguration Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?rev=810210&r1=810209&r2=810210&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java (original) +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Tue Sep 1 20:13:46 2009 @@ -107,7 +107,8 @@ suite.addTest(PoolDSAuthenticationTest.suite()); suite.addTest(XADSAuthenticationTest.suite()); suite.addTest(XATransactionTest.suite()); - + suite.addTest(XATest.suite()); + // Test uses JDBC 3.0 datasources, and javax.naming.Reference etc. suite.addTest(DataSourceReferenceTest.suite());