db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r179872 - /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java
Date Fri, 03 Jun 2005 19:51:49 GMT
Author: kmarsden
Date: Fri Jun  3 12:51:48 2005
New Revision: 179872

URL: http://svn.apache.org/viewcvs?rev=179872&view=rev
Log:
Backout accidental resultset.java checkin


Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java?rev=179872&r1=179871&r2=179872&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java
Fri Jun  3 12:51:48 2005
@@ -28,7 +28,6 @@
 import java.sql.Statement;
 import java.sql.SQLException;
 import java.sql.Types;
-import java.util.Properties;
 
 import java.lang.reflect.*;
 
@@ -46,8 +45,6 @@
  *
  * Test is only touching on known result set hot-spots at present.
  *
- * Modified May 31, 2005 pwilder
- *
  * @author ames
  */
 
@@ -74,13 +71,10 @@
 
 		try
 		{
-			
 			// use the ij utility to read the property file and
 			// make the initial connection.
-			
 			ij.getPropertyArg(args);
 			con = ij.startJBMS();
-			testImplicitClose(con);
 			// Test setCatalog/getCatalog for beetle 5504
 			con.setCatalog("mycatalog");
 			String cat = con.getCatalog();
@@ -529,11 +523,9 @@
 
 
 			stmt.close();
-			
+
 			testMutableValues(con);
 			testCorrelationNamesAndMetaDataCalls(con);
-			//This call does not work here, but works somewhere above.
-//			testImplicitClose(con);
 			con.close();
 
 		}
@@ -779,134 +771,6 @@
 			System.out.println("OK EQUALITY OBJECT RETURNED column " + col + " existing " + equals);
 
 		list.add(value);
-	}
-	
-	/**
-	 * testImplicitClose convenience function.
-	 * 
-	 * @param conn
-	 */
-	private static void testImplicitClose(Connection conn) {
-		testImplicitClose(conn, false, 2);
-	}
-	
-	/**
-	 * testImplicitClose convenience function.
-	 * 
-	 * @param conn
-	 */
-	private static void testImplicitClose(Connection conn, boolean prepared) {
-		testImplicitClose(conn, prepared, 2);
-	}
-	
-	/**
-	 * testImplicitClose convenience function.
-	 * 
-	 * @param conn
-	 */
-	private static void testImplicitClose(Connection conn, int numRows) {
-		testImplicitClose(conn, false, numRows);
-	}
-	
-	/**
-	 * The main function for testing the closing behavior of the ResultSet
-	 * 
-	 * @param conn The connection.
-	 * @param prepared Boolean specifying whether to use a PreparedStatement or not.
-	 * @param numRows The number of rows to use in the test case.
-	 */
-	private static void testImplicitClose(Connection conn, boolean prepared, int numRows) {
-		try {
-			String tableName = "implicitClose";
-			System.out.println("Begin ImplicitClose tests");
-			if (conn == null || conn.isClosed())  {
-				System.out.println("Invalid connection, cannot run ImplicitClose tests");
-				return;
-			}
-			Statement s = conn.createStatement();
-			
-			//Check to see if a table of this name already exists
-			ResultSet rs = s.executeQuery("Select tablename from sys.systables where tablename = '"
+ tableName + "'");
-			if (rs.next()) {
-				System.out.println("Table already exists. Can not run ImplicitClose tests");
-				return;
-			}
-			rs.close();
-			
-			s.execute("create table " + tableName + "(num int)");
-			s.close();
-			PreparedStatement ps = conn.prepareStatement("insert into implicitClose values (?)");
-			//Create and populate table
-			for (int i = 0; i < numRows; i++) {
-				ps.setInt(1, (i + 1));
-				ps.execute();
-			}
-			ps.close();
-		
-			if (prepared)
-				testImplicitClosePrepared(conn, tableName);
-			else
-				testImplicitCloseNonPrepared(conn, tableName);
-			
-			System.out.println("ImplicitClose tests complete");
-			
-		} catch (SQLException e) {
-			System.out.println("Unhandled exception in testImplicitClose: ");
-			e.printStackTrace();
-		}
-	}
-	/**
-	 * Uses a preparedStatement to generate the ResultSet
-	 * 
-	 * @param conn The Connection
-	 * @param tableName The name of the table being used
-	 * 
-	 * @throws SQLException
-	 */
-	private static void testImplicitClosePrepared(Connection conn, String tableName) throws
SQLException{
-		PreparedStatement ps = conn.prepareStatement("select num from " + tableName);
-		testImplicitCloseRSComponent(ps.executeQuery());
-//		ps.execute("drop table " + tableName);
-		ps.close();
-		Statement s = conn.createStatement();
-		s.execute("drop table " + tableName);
-		s.close();
-	}
-	
-	/**
-	 * Uses a normal statement to generate the ResultSet
-	 * 
-	 * @param conn The connection.
-	 * @param tableName The name of the table.
-	 * 
-	 * @throws SQLException 
-	 */
-	private static void testImplicitCloseNonPrepared(Connection conn, String tableName) throws
SQLException{
-		Statement s = conn.createStatement();
-		testImplicitCloseRSComponent(s.executeQuery("select * from " + tableName));
-		s.execute("drop table " + tableName);
-		s.close();
-	}
-	
-	/**
-	 * Tests the ResultSet generated by either the prepared or non prepared statement.
-	 * 
-	 * @param rs The resultSet
-	 * 
-	 * @throws SQLException
-	 */
-	private static void testImplicitCloseRSComponent(ResultSet rs) throws SQLException {
-		while (rs.next())
-			System.out.println(rs.getInt(1));
-		try {
-			System.out.println("Final call to ResultSet.next()");
-			rs.next();
-			rs.close();
-			System.out.println("Call successful");
-		} catch (SQLException ex) {
-			System.out.println("Call to ResultSet.next() thows the following exception: ");
-			ex.printStackTrace();
-		}
 	}
 }
 



Mime
View raw message